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

JARS does not respect encoding when reading application/x-www-form-urlencoded;charset=Iso-8859-1 parameters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.2
    • 2.3.7, 2.4.3, 2.5
    • JAX-RS
    • None
    • Unknown

    Description

      JAXRS calls UrlUtils.urlDecode(value);

      which has hardcoded UTF-8 as encoding:

      public static String urlDecode(String value) {
      try

      { value = URLDecoder.decode(value, "UTF-8"); }

      catch (UnsupportedEncodingException e)

      { LOG.warning("UTF-8 encoding can not be used to decode " + value); }

      return value;
      }

      I've provided the stack trace so that you can see which path it went through:

      java.lang.Exception: Stack trace
      at java.lang.Thread.dumpStack(Thread.java:1206)
      at org.apache.cxf.common.util.UrlUtils.urlDecode(UrlUtils.java:53)
      at org.apache.cxf.jaxrs.utils.HttpUtils.urlDecode(HttpUtils.java:72)
      at org.apache.cxf.jaxrs.utils.FormUtils.populateMapFromString(FormUtils.java:85)
      at org.apache.cxf.jaxrs.utils.JAXRSUtils.processFormParam(JAXRSUtils.java:732)
      at org.apache.cxf.jaxrs.utils.JAXRSUtils.createHttpParameterValue(JAXRSUtils.java:659)
      at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:617)
      at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:571)
      at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:230)
      at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88)
      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.doPost(AbstractHTTPServlet.java:107)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:163)

      Attachments

        1. JAXRSUtilsTest.java.diff
          3 kB
          Marc Giger

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            gigerstyle Marc Giger
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: