Fix a possible NPE in HiddenErrorHandler
From our server logs I observe that sporadically the HttpConnection.getCurrentConnection() returns null which causes a NPE in the HiddenErrorHandler.message method. Change-Id: Ib34ccf49482cd051d9c3609c3876cc4993ec6eb1
This commit is contained in:

committed by
David Pursehouse

parent
226abb7873
commit
1a004d3e3e
@@ -64,10 +64,15 @@ class HiddenErrorHandler extends ErrorHandler {
|
||||
}
|
||||
|
||||
private static byte[] message(HttpConnection conn) {
|
||||
String msg = conn.getHttpChannel().getResponse().getReason();
|
||||
if (msg == null) {
|
||||
msg = HttpStatus.getMessage(conn.getHttpChannel()
|
||||
.getResponse().getStatus());
|
||||
String msg;
|
||||
if (conn == null) {
|
||||
msg = "";
|
||||
} else {
|
||||
msg = conn.getHttpChannel().getResponse().getReason();
|
||||
if (msg == null) {
|
||||
msg = HttpStatus.getMessage(conn.getHttpChannel()
|
||||
.getResponse().getStatus());
|
||||
}
|
||||
}
|
||||
return msg.getBytes(ISO_8859_1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user