Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ public ApiException exception() {
return this.exception;
}

/**
* Returns the class name of the exception
*/
public String exceptionName() {
return exception.getClass().getName();
}

/**
* The error code for the exception
*/
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/kafka/api/OffsetResponse.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ object OffsetResponse {

case class PartitionOffsetsResponse(error: Short, offsets: Seq[Long]) {
override def toString(): String = {
new String("error: " + Errors.forCode(error).exception.getClass.getName + " offsets: " + offsets.mkString)
new String("error: " + Errors.forCode(error).exceptionName + " offsets: " + offsets.mkString)
}
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/kafka/api/TopicMetadata.scala
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ case class TopicMetadata(topic: String, partitionsMetadata: Seq[PartitionMetadat
partitionMetadata.partitionId, partitionMetadata.toString()))
case error: Errors =>
topicMetadataInfo.append("\nMetadata for partition [%s,%d] is not available due to %s".format(topic,
partitionMetadata.partitionId, error.exception.getClass.getName))
partitionMetadata.partitionId, error.exceptionName))
}
}
case error: Errors =>
topicMetadataInfo.append("\nNo partition metadata for topic %s due to %s".format(topic,
error.exception.getClass.getName))
error.exceptionName))
}
topicMetadataInfo.append("}")
topicMetadataInfo.toString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class GroupMetadataManager(val brokerId: Int,
var responseCode = Errors.NONE.code
if (status.error != Errors.NONE.code) {
debug("Metadata from group %s with generation %d failed when appending to log due to %s"
.format(group.groupId, generationId, Errors.forCode(status.error).exception.getClass.getName))
.format(group.groupId, generationId, Errors.forCode(status.error).exceptionName))

// transform the log append error code to the corresponding the commit status error code
responseCode = if (status.error == Errors.UNKNOWN_TOPIC_OR_PARTITION.code) {
Expand All @@ -206,7 +206,7 @@ class GroupMetadataManager(val brokerId: Int,
|| status.error == Errors.INVALID_FETCH_SIZE.code) {

error("Appending metadata message for group %s generation %d failed due to %s, returning UNKNOWN error code to the client"
.format(group.groupId, generationId, Errors.forCode(status.error).exception.getClass.getName))
.format(group.groupId, generationId, Errors.forCode(status.error).exceptionName))

Errors.UNKNOWN.code
} else {
Expand Down Expand Up @@ -278,7 +278,7 @@ class GroupMetadataManager(val brokerId: Int,
Errors.NONE.code
} else {
debug("Offset commit %s from group %s consumer %s with generation %d failed when appending to log due to %s"
.format(filteredOffsetMetadata, groupId, consumerId, generationId, Errors.forCode(status.error).exception.getClass.getName))
.format(filteredOffsetMetadata, groupId, consumerId, generationId, Errors.forCode(status.error).exceptionName))

// transform the log append error code to the corresponding the commit status error code
if (status.error == Errors.UNKNOWN_TOPIC_OR_PARTITION.code)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ class DefaultEventHandler[K,V](config: ProducerConfig,
(p1._1.topic.compareTo(p2._1.topic) == 0 && p1._1.partition < p2._1.partition))
.map{
case(topicAndPartition, status) =>
topicAndPartition.toString + ": " + Errors.forCode(status.error).exception.getClass.getName
topicAndPartition.toString + ": " + Errors.forCode(status.error).exceptionName
}.mkString(",")
warn("Produce request with correlation id %d failed due to %s".format(currentCorrelationId, errorString))
}
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/scala/kafka/server/KafkaApis.scala
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class KafkaApis(val requestChannel: RequestChannel,
if (errorCode != Errors.NONE.code) {
debug("Offset commit request with correlation id %d from client %s on partition %s failed due to %s"
.format(offsetCommitRequest.correlationId, offsetCommitRequest.clientId,
topicAndPartition, Errors.forCode(errorCode).exception.getClass.getName))
topicAndPartition, Errors.forCode(errorCode).exceptionName))
}
}
val combinedCommitStatus = mergedCommitStatus ++ invalidRequestsInfo.map(_._1 -> Errors.UNKNOWN_TOPIC_OR_PARTITION.code)
Expand Down Expand Up @@ -336,7 +336,7 @@ class KafkaApis(val requestChannel: RequestChannel,
produceRequest.correlationId,
produceRequest.clientId,
topicAndPartition,
Errors.forCode(status.error).exception.getClass.getName))
Errors.forCode(status.error).exceptionName))
}
}

Expand All @@ -348,7 +348,7 @@ class KafkaApis(val requestChannel: RequestChannel,
// the producer client will know that some error has happened and will refresh its metadata
if (errorInResponse) {
val exceptionsSummary = mergedResponseStatus.map { case (topicAndPartition, status) =>
topicAndPartition -> Errors.forCode(status.error).exception.getClass.getName
topicAndPartition -> Errors.forCode(status.error).exceptionName
}.mkString(", ")
info(
s"Closing connection due to error during produce request with correlation id ${produceRequest.correlationId} " +
Expand Down Expand Up @@ -418,7 +418,7 @@ class KafkaApis(val requestChannel: RequestChannel,
if (data.error != Errors.NONE.code) {
debug("Fetch request with correlation id %d from client %s on partition %s failed due to %s"
.format(fetchRequest.correlationId, fetchRequest.clientId,
topicAndPartition, Errors.forCode(data.error).exception.getClass.getName))
topicAndPartition, Errors.forCode(data.error).exceptionName))
}
// record the bytes out metrics only when the response is being sent
BrokerTopicStats.getBrokerTopicStats(topicAndPartition.topic).bytesOutRate.mark(data.messages.sizeInBytes)
Expand Down