cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yu...@apache.org
Subject [1/6] cassandra git commit: Fix NPE when internode compression is off
Date Fri, 07 Aug 2015 03:06:29 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.2 fa6205c90 -> ed4fad19e
  refs/heads/cassandra-3.0 a472aa9ea -> 0a94c7a36
  refs/heads/trunk 709510e32 -> 448e276b7


Fix NPE when internode compression is off

patch by yukim; reviewed by Jeremiah Jordan; follow up for CASSANDRA-9884


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

Branch: refs/heads/cassandra-2.2
Commit: ed4fad19ecd9b02892623ffd538c0c45dcdc5a56
Parents: fa6205c
Author: Yuki Morishita <yukim@apache.org>
Authored: Thu Aug 6 22:04:54 2015 -0500
Committer: Yuki Morishita <yukim@apache.org>
Committed: Thu Aug 6 22:04:54 2015 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/net/IncomingTcpConnection.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ed4fad19/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/IncomingTcpConnection.java b/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
index 375da64..cfdb854 100644
--- a/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
+++ b/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
@@ -21,6 +21,8 @@ import java.io.*;
 import java.net.InetAddress;
 import java.net.Socket;
 import java.net.SocketException;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
 import java.util.zip.Checksum;
 import java.util.Set;
 
@@ -162,7 +164,8 @@ public class IncomingTcpConnection extends Thread implements Closeable
         }
         else
         {
-            in = new NIODataInputStream(socket.getChannel(), BUFFER_SIZE);
+            ReadableByteChannel channel = socket.getChannel();
+            in = new NIODataInputStream(channel != null ? channel : Channels.newChannel(socket.getInputStream()),
BUFFER_SIZE);
         }
 
         while (true)


Mime
View raw message