kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guozh...@apache.org
Subject kafka git commit: MINOR: Fix hard coded strings in ProduceResponse
Date Wed, 12 Aug 2015 21:33:10 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk a62d63007 -> 3902dc024


MINOR: Fix hard coded strings in ProduceResponse

Author: Grant Henke <granthenke@gmail.com>

Reviewers: Ismael Juma, Ewen Cheslack-Postava and Guozhang Wang

Closes #131 from granthenke/minor-string and squashes the following commits:

3c6250d [Grant Henke] MINOR: Fix hard coded strings in ProduceResponse


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/3902dc02
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/3902dc02
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/3902dc02

Branch: refs/heads/trunk
Commit: 3902dc024595baf715cdfc8fa4b66aacbeca72d1
Parents: a62d630
Author: Grant Henke <granthenke@gmail.com>
Authored: Wed Aug 12 14:34:30 2015 -0700
Committer: Guozhang Wang <wangguoz@gmail.com>
Committed: Wed Aug 12 14:34:30 2015 -0700

----------------------------------------------------------------------
 .../apache/kafka/common/requests/ProduceResponse.java   | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/3902dc02/clients/src/main/java/org/apache/kafka/common/requests/ProduceResponse.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/common/requests/ProduceResponse.java b/clients/src/main/java/org/apache/kafka/common/requests/ProduceResponse.java
index 37ec0b7..febfc70 100644
--- a/clients/src/main/java/org/apache/kafka/common/requests/ProduceResponse.java
+++ b/clients/src/main/java/org/apache/kafka/common/requests/ProduceResponse.java
@@ -76,14 +76,14 @@ public class ProduceResponse extends AbstractRequestResponse {
     public ProduceResponse(Struct struct) {
         super(struct);
         responses = new HashMap<TopicPartition, PartitionResponse>();
-        for (Object topicResponse : struct.getArray("responses")) {
+        for (Object topicResponse : struct.getArray(RESPONSES_KEY_NAME)) {
             Struct topicRespStruct = (Struct) topicResponse;
-            String topic = topicRespStruct.getString("topic");
-            for (Object partResponse : topicRespStruct.getArray("partition_responses")) {
+            String topic = topicRespStruct.getString(TOPIC_KEY_NAME);
+            for (Object partResponse : topicRespStruct.getArray(PARTITION_RESPONSES_KEY_NAME))
{
                 Struct partRespStruct = (Struct) partResponse;
-                int partition = partRespStruct.getInt("partition");
-                short errorCode = partRespStruct.getShort("error_code");
-                long offset = partRespStruct.getLong("base_offset");
+                int partition = partRespStruct.getInt(PARTITION_KEY_NAME);
+                short errorCode = partRespStruct.getShort(ERROR_CODE_KEY_NAME);
+                long offset = partRespStruct.getLong(BASE_OFFSET_KEY_NAME);
                 TopicPartition tp = new TopicPartition(topic, partition);
                 responses.put(tp, new PartitionResponse(errorCode, offset));
             }


Mime
View raw message