kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jjko...@apache.org
Subject [31/37] git commit: kafka-1542 (trivail followup patch to fix NullPointerException); normal IOException in the new producer is logged as ERROR; patched by Jun Rao
Date Tue, 05 Aug 2014 23:00:28 GMT
kafka-1542 (trivail followup patch to fix NullPointerException); normal IOException in the
new producer is logged as ERROR; patched by Jun Rao


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

Branch: refs/heads/transactional_messaging
Commit: 50f2b245c1a666400fab7ddfdebf7c1c2bdf3084
Parents: f489493
Author: Jun Rao <junrao@gmail.com>
Authored: Mon Jul 28 10:58:58 2014 -0700
Committer: Jun Rao <junrao@gmail.com>
Committed: Mon Jul 28 10:58:58 2014 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/kafka/common/network/Selector.java   | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/50f2b245/clients/src/main/java/org/apache/kafka/common/network/Selector.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/common/network/Selector.java b/clients/src/main/java/org/apache/kafka/common/network/Selector.java
index 45e57b4..4dd2cdf 100644
--- a/clients/src/main/java/org/apache/kafka/common/network/Selector.java
+++ b/clients/src/main/java/org/apache/kafka/common/network/Selector.java
@@ -13,6 +13,7 @@
 package org.apache.kafka.common.network;
 
 import java.io.IOException;
+import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.Socket;
 import java.nio.channels.CancelledKeyException;
@@ -262,7 +263,11 @@ public class Selector implements Selectable {
                     if (!key.isValid())
                         close(key);
                 } catch (IOException e) {
-                    log.warn("Error in I/O with {}",channel.socket().getInetAddress().getHostAddress()
, e);
+                    InetAddress remoteAddress = null;
+                    Socket socket = channel.socket();
+                    if (socket != null)
+                        remoteAddress = socket.getInetAddress();
+                    log.warn("Error in I/O with {}", remoteAddress , e);
                     close(key);
                 }
             }


Mime
View raw message