Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-3499

URIMappingInterceptor and ArrayIndexOutOfBoundsException

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 2.4.1, 2.3.5
    • Component/s: Core
    • Labels:
    • Environment:

      Tomcat 6.0.23, Spring 3.0.5, CXF 2.4.1

    • Estimated Complexity:
      Novice

      Description

      URIMappingInterceptor keeps throwing:

      May 6, 2011 11:52:35 AM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
      WARNING: Interceptor for

      {http://ws.ds.soc.com/}

      MessageService has thrown exception, unwinding now
      java.lang.ArrayIndexOutOfBoundsException: 1
      at org.apache.cxf.interceptor.URIMappingInterceptor.getQueries(URIMappingInterceptor.java:319)
      at org.apache.cxf.interceptor.URIMappingInterceptor.getParameters(URIMappingInterceptor.java:165)
      at org.apache.cxf.interceptor.URIMappingInterceptor.handleMessage(URIMappingInterceptor.java:102)
      at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
      at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:118)
      at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:208)
      at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)
      at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:166)
      at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:113)
      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:112)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:163)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      at java.lang.Thread.run(Thread.java:619)

      Current Code Affected:

              if (!StringUtils.isEmpty(query)) {            
                  List<String> parts = Arrays.asList(query.split("&"));
                  for (String part : parts) {
                      if (part.contains("=")) {
                          String[] keyValue = part.split("=");
                          queries.put(keyValue[0], uriDecode(keyValue[1]));
                      }
                  }
                  return queries;
              }
      

      Proposed Code Fix:

              if (!StringUtils.isEmpty(query)) { 
                  List<String> parts = Arrays.asList(query.split("&"));
                  for (String part : parts) {
                      if (part.contains("=")) {
                          String[] keyValue = part.split("=");
                          if (keyValue.length >= 2) {
                          	queries.put(keyValue[0], uriDecode(keyValue[1]));
                          }
                      }
                  }
                  return queries;
              }
      

      Diagnosis of Problem:
      If the value portion of the name/value pair is missing, then the keyValue length will only be 1, and consequently there will be no index entry 1.

        Attachments

          Activity

            People

            • Assignee:
              ffang Freeman Yue Fang
              Reporter:
              rdgrimes Ron Grimes

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified

                  Issue deployment