Skip to content

Commit 0753031

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]>
1 parent 98653ec commit 0753031

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
@@ -2155,7 +2155,7 @@ private void doSaslReply(Message message) throws IOException {
21552155
private void doSaslReply(Exception ioe) throws IOException {
21562156
setupResponse(authFailedCall,
21572157
RpcStatusProto.FATAL, RpcErrorCodeProto.FATAL_UNAUTHORIZED,
2158-
null, ioe.getClass().getName(), ioe.getLocalizedMessage());
2158+
null, ioe.getClass().getName(), ioe.toString());
21592159
sendResponse(authFailedCall);
21602160
}
21612161

@@ -2550,7 +2550,8 @@ private void processOneRpc(ByteBuffer bb)
25502550
final RpcCall call = new RpcCall(this, callId, retry);
25512551
setupResponse(call,
25522552
rse.getRpcStatusProto(), rse.getRpcErrorCodeProto(), null,
2553-
t.getClass().getName(), t.getMessage());
2553+
t.getClass().getName(),
2554+
t.getMessage() != null ? t.getMessage() : t.toString());
25542555
sendResponse(call);
25552556
}
25562557
}

0 commit comments

Comments
 (0)