HADOOP-9844. NPE when trying to create an error message response of SASL RPC

This closes #55

Change-Id: I10a20380565fa89762f4aa564b2f1c83b9aeecdc
Signed-off-by: Akira Ajisaka <aajisaka@apache.org>
This commit is contained in:
Steve Loughran 2017-10-13 13:31:01 +01:00 committed by Akira Ajisaka
parent 98653ecccb
commit 07530314c2
No known key found for this signature in database
GPG Key ID: C1EDBB9CA400FD50
2 changed files with 5 additions and 5 deletions

View File

@ -26,9 +26,8 @@ import java.io.IOException;
*/ */
public class IpcException extends IOException { public class IpcException extends IOException {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
final String errMsg;
public IpcException(final String err) { public IpcException(final String err) {
errMsg = err; super(err);
} }
} }

View File

@ -2155,7 +2155,7 @@ public abstract class Server {
private void doSaslReply(Exception ioe) throws IOException { private void doSaslReply(Exception ioe) throws IOException {
setupResponse(authFailedCall, setupResponse(authFailedCall,
RpcStatusProto.FATAL, RpcErrorCodeProto.FATAL_UNAUTHORIZED, RpcStatusProto.FATAL, RpcErrorCodeProto.FATAL_UNAUTHORIZED,
null, ioe.getClass().getName(), ioe.getLocalizedMessage()); null, ioe.getClass().getName(), ioe.toString());
sendResponse(authFailedCall); sendResponse(authFailedCall);
} }
@ -2550,7 +2550,8 @@ public abstract class Server {
final RpcCall call = new RpcCall(this, callId, retry); final RpcCall call = new RpcCall(this, callId, retry);
setupResponse(call, setupResponse(call,
rse.getRpcStatusProto(), rse.getRpcErrorCodeProto(), null, rse.getRpcStatusProto(), rse.getRpcErrorCodeProto(), null,
t.getClass().getName(), t.getMessage()); t.getClass().getName(),
t.getMessage() != null ? t.getMessage() : t.toString());
sendResponse(call); sendResponse(call);
} }
} }