1. glassfish
  2. GLASSFISH-18444

Incompatibel breaking changes to getParameter() / getPart() probably for Ticket GLASSFISH-16740


    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.2_dev
    • Fix Version/s:, 4.0_dev
    • Component/s: web_container
    • Labels:
    • Environment:

      Linux version 2.6.32-38-generic


      The attached servlet shows a problem when calling HttpServletRequest.getParameter(name) before response.getWriter()/getInputStream().

      In glassfish 3.1 this used to work and print out the form data (the content of the InputStream could still be used after calling getParameter()). This has changed in glassfish 3.1.2 probably because of the changes for GLASSFISH-16740.

      These changes will cause major problems in web applications that use multipart formdata, but do not yet use the getParts() method to retrieve the data, but some proprietary method. Any call to getParameter() before the files are parsed will cause the parsing of the multipart formdata to fail. I'm currently experiencing this with the Magnolia CMS ( where every single form stopped working in glassfish 3.1.2 with the following exception: Corrupt form data: premature ending
      at com.oreilly.servlet.multipart.MultipartParser.<init>(
      at com.oreilly.servlet.MultipartRequest.<init>(
      at info.magnolia.cms.filters.CosMultipartRequestFilter.parseParameters(
      at info.magnolia.cms.filters.CosMultipartRequestFilter.doFilter(
      at info.magnolia.cms.filters.OncePerRequestAbstractMgnlFilter.doFilter(
      at info.magnolia.cms.filters.MgnlFilterChain.doFilter(
      at info.magnolia.cms.filters.ContentTypeFilter.doFilter(
      at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(
      at info.magnolia.cms.filters.MgnlFilterChain.doFilter(
      at info.magnolia.cms.filters.ContextFilter.doFilter(
      at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(
      at info.magnolia.cms.filters.MgnlFilterChain.doFilter(
      at info.magnolia.cms.filters.CompositeFilter.doFilter(
      at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(
      at info.magnolia.cms.filters.MgnlMainFilter.doFilter(
      at info.magnolia.cms.filters.MgnlMainFilter.doFilter(
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(
      at org.apache.catalina.core.StandardWrapperValve.invoke(
      at org.apache.catalina.core.StandardContextValve.invoke(
      at org.apache.catalina.core.StandardPipeline.doInvoke(
      at org.apache.catalina.core.StandardPipeline.invoke(
      at org.apache.catalina.core.StandardHostValve.invoke(
      at org.apache.catalina.connector.CoyoteAdapter.doService(
      at org.apache.catalina.connector.CoyoteAdapter.service(
      at com.sun.grizzly.http.ProcessorTask.invokeAdapter(
      at com.sun.grizzly.http.ProcessorTask.doProcess(
      at com.sun.grizzly.http.ProcessorTask.process(
      at com.sun.grizzly.http.DefaultProtocolFilter.execute(
      at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(
      at com.sun.grizzly.DefaultProtocolChain.execute(
      at com.sun.grizzly.DefaultProtocolChain.execute(
      at com.sun.grizzly.http.HttpProtocolChain.execute(
      at com.sun.grizzly.ProtocolChainContextTask.doCall(
      at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(
      at com.sun.grizzly.util.AbstractThreadPool$

      I think a better way to do this is to only parse the multipart formdata for Servlets that have an javax.servlet.annotation.MultipartConfig annotation. The JavaDocs for this class state:
      "the Servlets annotated with MultipartConfig may retrieve the Part components of a given multipart/form-data request by calling getPart or getParts."
      So servlets without this annotation should not expect the getParts() method to work anyway.

        1 kB

        Issue Links


          nmehner created issue -
          Shing Wai Chan made changes -
          Field Original Value New Value
          Assignee Shing Wai Chan [ swchan2 ] kchung [ kchung ]
          Joe Di Pol made changes -
          Link This issue is related to GLASSFISH-16740 [ GLASSFISH-16740 ]
          kchung made changes -
          Attachment web-core.jar [ 49498 ]
          kchung made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 4.0_ms02 [ 14744 ]
          Resolution Fixed [ 1 ]
          Joe Di Pol made changes -
          Fix Version/s 4.0_b37_ms2 [ 15626 ]
          Fix Version/s 4.0_ms02 [ 14744 ]
          Joe Di Pol made changes -
          Tags 3_1_2-next
          Joe Di Pol made changes -
          Fix Version/s [ 15916 ]
          Amy Roh made changes -
          Link This issue blocks GLASSFISH-18505 [ GLASSFISH-18505 ]
          Joe Di Pol made changes -
          Affects Version/s 3.1.2_dev [ 17782 ]
          Joe Di Pol made changes -
          Fix Version/s 4.0_dev [ 17784 ]


            • Assignee:
            • Votes:
              5 Vote for this issue
              9 Start watching this issue


              • Created: