Skip to content

Commit 5ec4108

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 <aajisaka@apache.org> (cherry picked from commit 0753031) (cherry picked from commit c0fd09c)
1 parent 6b54445 commit 5ec4108

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

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

0 commit comments

Comments
 (0)