Skip to content

Commit c0fd09c

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 3bfae20 commit c0fd09c

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
@@ -1948,7 +1948,7 @@ private void doSaslReply(Message message) throws IOException {
19481948
private void doSaslReply(Exception ioe) throws IOException {
19491949
setupResponse(authFailedCall,
19501950
RpcStatusProto.FATAL, RpcErrorCodeProto.FATAL_UNAUTHORIZED,
1951-
null, ioe.getClass().getName(), ioe.getLocalizedMessage());
1951+
null, ioe.getClass().getName(), ioe.toString());
19521952
sendResponse(authFailedCall);
19531953
}
19541954

@@ -2307,7 +2307,8 @@ private void processOneRpc(ByteBuffer bb)
23072307
final RpcCall call = new RpcCall(this, callId, retry);
23082308
setupResponse(call,
23092309
rse.getRpcStatusProto(), rse.getRpcErrorCodeProto(), null,
2310-
t.getClass().getName(), t.getMessage());
2310+
t.getClass().getName(),
2311+
t.getMessage() != null ? t.getMessage() : t.toString());
23112312
sendResponse(call);
23122313
}
23132314
}

0 commit comments

Comments
 (0)