commit d9f3066558938aa8c0ad2d2227adbb0efb571d16 Author: todd Date: Tue Apr 13 18:51:33 2010 -0700 HBASE-2443. IPC client can throw NPE if socket creation fails diff --git src/java/org/apache/hadoop/hbase/ipc/HBaseClient.java src/java/org/apache/hadoop/hbase/ipc/HBaseClient.java index a4a33f5..f23c957 100644 --- src/java/org/apache/hadoop/hbase/ipc/HBaseClient.java +++ src/java/org/apache/hadoop/hbase/ipc/HBaseClient.java @@ -350,10 +350,12 @@ public class HBaseClient { private void handleConnectionFailure( int curRetries, int maxRetries, IOException ioe) throws IOException { // close the current connection - try { - socket.close(); - } catch (IOException e) { - LOG.warn("Not able to close a socket", e); + if (socket != null) { // could be null if the socket creation failed + try { + socket.close(); + } catch (IOException e) { + LOG.warn("Not able to close a socket", e); + } } // set socket to null so that the next call to setupIOstreams // can start the process of connect all over again.