This is an automated email from the ASF dual-hosted git repository.

robertlazarski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git

commit e236604edd512f910fef55554fc661d6d5312a82
Author: Robert Lazarski <robertlazar...@gmail.com>
AuthorDate: Fri Mar 21 03:38:51 2025 -1000

    AXIS2-6086 AxisServlet - processAxisFault - does not guard against 
NumberFormatException
---
 .../java/org/apache/axis2/transport/http/AxisServlet.java     | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git 
a/modules/transport/http/src/main/java/org/apache/axis2/transport/http/AxisServlet.java
 
b/modules/transport/http/src/main/java/org/apache/axis2/transport/http/AxisServlet.java
index ecccc73e4a..0f346efacf 100644
--- 
a/modules/transport/http/src/main/java/org/apache/axis2/transport/http/AxisServlet.java
+++ 
b/modules/transport/http/src/main/java/org/apache/axis2/transport/http/AxisServlet.java
@@ -417,11 +417,16 @@ public class AxisServlet extends HttpServlet {
                 String status =
                         (String) 
msgContext.getProperty(Constants.HTTP_RESPONSE_STATE);
                 if (status == null) {
-                    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);
+                    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);
                     
res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
                 } else {
-                    log.error("processAxisFault() found an HTTP status from 
the MessageContext instance, setting HttpServletResponse status to: " + status);
-                    res.setStatus(Integer.parseInt(status));
+                    log.debug("processAxisFault() found an HTTP status from 
the MessageContext instance, setting HttpServletResponse status to: " + status);
+                    try {
+                        res.setStatus(Integer.parseInt(status));
+                    } catch (Exception ex) {
+                        log.error("Invalid http status, setting status to http 
error state: " + ex.getMessage(), ex);
+                        
res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+                    }
                     return;
                 }
 

Reply via email to