Skip to content

Commit e236604

Browse files
AXIS2-6086 AxisServlet - processAxisFault - does not guard against NumberFormatException
1 parent 3f5a888 commit e236604

File tree

1 file changed

+8
-3
lines changed
  • modules/transport/http/src/main/java/org/apache/axis2/transport/http

1 file changed

+8
-3
lines changed

modules/transport/http/src/main/java/org/apache/axis2/transport/http/AxisServlet.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,11 +417,16 @@ void processAxisFault(MessageContext msgContext, HttpServletResponse res,
417417
String status =
418418
(String) msgContext.getProperty(Constants.HTTP_RESPONSE_STATE);
419419
if (status == null) {
420-
log.error("processAxisFault() on error message: " + e.getMessage() + " , found a null HTTP status from the MessageContext instance, setting HttpServletResponse status to HttpServletResponse.SC_INTERNAL_SERVER_ERROR", e);
420+
log.info("processAxisFault() on error message: " + e.getMessage() + " , found a null HTTP status from the MessageContext instance, setting HttpServletResponse status to HttpServletResponse.SC_INTERNAL_SERVER_ERROR", e);
421421
res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
422422
} else {
423-
log.error("processAxisFault() found an HTTP status from the MessageContext instance, setting HttpServletResponse status to: " + status);
424-
res.setStatus(Integer.parseInt(status));
423+
log.debug("processAxisFault() found an HTTP status from the MessageContext instance, setting HttpServletResponse status to: " + status);
424+
try {
425+
res.setStatus(Integer.parseInt(status));
426+
} catch (Exception ex) {
427+
log.error("Invalid http status, setting status to http error state: " + ex.getMessage(), ex);
428+
res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
429+
}
425430
return;
426431
}
427432

0 commit comments

Comments
 (0)