Skip to content

Commit 7418764

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 2478d33 commit 7418764

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
@@ -2040,7 +2040,7 @@ private void doSaslReply(Message message) throws IOException {
20402040
private void doSaslReply(Exception ioe) throws IOException {
20412041
setupResponse(authFailedCall,
20422042
RpcStatusProto.FATAL, RpcErrorCodeProto.FATAL_UNAUTHORIZED,
2043-
null, ioe.getClass().getName(), ioe.getLocalizedMessage());
2043+
null, ioe.getClass().getName(), ioe.toString());
20442044
sendResponse(authFailedCall);
20452045
}
20462046

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

0 commit comments

Comments
 (0)