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

JAXRSInInterceptor throw java.lang.IndexOutOfBoundsException if content-type header is empty

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.2
    • 3.0.6, 2.7.17, 3.1.2
    • JAX-RS
    • None
    • Unknown

    Description

      If client send an empty Content-Type headers CXF REST runtime throws java.lang.IndexOutOfBoundsException because list in string 122 (JAXRSInInterceptor.java) is emty

      // Content-Type
      String requestContentType = null;
      List<String> ctHeaderValues = protocolHeaders.get(Message.CONTENT_TYPE);
      if (ctHeaderValues != null)

      { ====> requestContentType = ctHeaderValues.get(0); message.put(Message.CONTENT_TYPE, requestContentType); }

      Stack trace:
      java.lang.IndexOutOfBoundsException: Index: 0, Size: 0<br /> at java.util.ArrayList.rangeCheck(ArrayList.java:635)<br /> at java.util.ArrayList.get(ArrayList.java:411)<br /> at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:122)<br /> at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:77)<br /> at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)<br /> at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)<br /> at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:243)<br /> at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)<br /> at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:197)<br /> at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:149)<br /> at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:171)<br /> at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:290)<br /> at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doDelete(AbstractHTTPServlet.java:220)<br /> at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)

      Attachments

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            valeriy.molyakov Valeriy Molyakov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: