HBASE-5759 HBaseClient throws NullPointerException when EOFException should be used.

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1311899 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2012-04-10 18:15:25 +00:00
parent f4ea4f4f07
commit 7d1f7b7f37
1 changed files with 6 additions and 0 deletions

View File

@ -24,6 +24,7 @@ import java.io.BufferedInputStream;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.EOFException;
import java.io.FilterInputStream; import java.io.FilterInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -563,6 +564,11 @@ public class HBaseClient {
// Read the call id. // Read the call id.
RpcResponse response = RpcResponse.parseDelimitedFrom(in); RpcResponse response = RpcResponse.parseDelimitedFrom(in);
if (response == null) {
// When the stream is closed, protobuf doesn't raise an EOFException,
// instead, it returns a null message object.
throw new EOFException();
}
int id = response.getCallId(); int id = response.getCallId();
if (LOG.isDebugEnabled()) if (LOG.isDebugEnabled())