Skip to content

Commit 1b7c7dc

Browse files
steveloughranaajisaka
authored andcommitted
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 <[email protected]> (cherry picked from commit 0753031)
1 parent bf4a225 commit 1b7c7dc

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/IpcException.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@
2626
*/
2727
public class IpcException extends IOException {
2828
private static final long serialVersionUID = 1L;
29-
30-
final String errMsg;
29+
3130
public IpcException(final String err) {
32-
errMsg = err;
31+
super(err);
3332
}
3433
}

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2041,7 +2041,7 @@ private void doSaslReply(Message message) throws IOException {
20412041
private void doSaslReply(Exception ioe) throws IOException {
20422042
setupResponse(authFailedCall,
20432043
RpcStatusProto.FATAL, RpcErrorCodeProto.FATAL_UNAUTHORIZED,
2044-
null, ioe.getClass().getName(), ioe.getLocalizedMessage());
2044+
null, ioe.getClass().getName(), ioe.toString());
20452045
sendResponse(authFailedCall);
20462046
}
20472047

@@ -2436,7 +2436,8 @@ private void processOneRpc(ByteBuffer bb)
24362436
final RpcCall call = new RpcCall(this, callId, retry);
24372437
setupResponse(call,
24382438
rse.getRpcStatusProto(), rse.getRpcErrorCodeProto(), null,
2439-
t.getClass().getName(), t.getMessage());
2439+
t.getClass().getName(),
2440+
t.getMessage() != null ? t.getMessage() : t.toString());
24402441
sendResponse(call);
24412442
}
24422443
}

0 commit comments

Comments
 (0)