HBASE-2443 IPC client can throw NPE if socket creation fails

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@936107 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-04-20 23:02:57 +00:00
parent 2b2f1d1670
commit 3cb1168601
2 changed files with 8 additions and 4 deletions

View File

@ -279,6 +279,8 @@ Release 0.21.0 - Unreleased
is a prefix (Todd Lipcon via Stack)
HBASE-2463 Various Bytes.* functions silently ignore invalid arguments
(Benoit Sigoure via Stack)
HBASE-2443 IPC client can throw NPE if socket creation fails
(Todd Lipcon via Stack)
IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable

View File

@ -351,10 +351,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.