glassfish
  1. glassfish
  2. GLASSFISH-18444

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

    Details

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

      Linux version 2.6.32-38-generic

      Description

      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 (http://www.magnolia-cms.com/) where every single form stopped working in glassfish 3.1.2 with the following exception:

      java.io.IOException: Corrupt form data: premature ending
      at com.oreilly.servlet.multipart.MultipartParser.<init>(MultipartParser.java:205)
      at com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:222)
      at info.magnolia.cms.filters.CosMultipartRequestFilter.parseParameters(CosMultipartRequestFilter.java:101)
      at info.magnolia.cms.filters.CosMultipartRequestFilter.doFilter(CosMultipartRequestFilter.java:81)
      at info.magnolia.cms.filters.OncePerRequestAbstractMgnlFilter.doFilter(OncePerRequestAbstractMgnlFilter.java:60)
      at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:82)
      at info.magnolia.cms.filters.ContentTypeFilter.doFilter(ContentTypeFilter.java:104)
      at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:88)
      at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:82)
      at info.magnolia.cms.filters.ContextFilter.doFilter(ContextFilter.java:120)
      at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:88)
      at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:82)
      at info.magnolia.cms.filters.CompositeFilter.doFilter(CompositeFilter.java:66)
      at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:88)
      at info.magnolia.cms.filters.MgnlMainFilter.doFilter(MgnlMainFilter.java:105)
      at info.magnolia.cms.filters.MgnlMainFilter.doFilter(MgnlMainFilter.java:216)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
      at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
      at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
      at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
      at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
      at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
      at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
      at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
      at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
      at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
      at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
      at java.lang.Thread.run(Thread.java:662)

      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. TestServlet.java
        1 kB
        nmehner

        Issue Links

          Activity

          Hide
          hadrianhu added a comment -

          hi kchung, i'm having the same issue with glassfish 4? any know fixes for it? please please help, i have a deadline to finish a project and to switch to glassfish 3 at this point is just not an option ...any thoughts?

          Show
          hadrianhu added a comment - hi kchung, i'm having the same issue with glassfish 4? any know fixes for it? please please help, i have a deadline to finish a project and to switch to glassfish 3 at this point is just not an option ...any thoughts?
          Hide
          kchung added a comment -

          Folks, I think the fix is already in glassfish 4.0. If you still have the problem, it could be something else. I need a small test case to begin looking for a fix.

          Show
          kchung added a comment - Folks, I think the fix is already in glassfish 4.0. If you still have the problem, it could be something else. I need a small test case to begin looking for a fix.
          Hide
          taranyury added a comment - - edited

          I found that this problem appears with JSF 2.2 only. And no matter which Glassfish is (3.1.2 or 4.0)

          Show
          taranyury added a comment - - edited I found that this problem appears with JSF 2.2 only. And no matter which Glassfish is (3.1.2 or 4.0)
          Hide
          octabrain added a comment -

          I have the same issue with JSF 2.2 and Glassfish 4. Richfaces is the only installed framework.

          I cannot switch to earlier JSF or Glassfish. It's a severe problem.

          Show
          octabrain added a comment - I have the same issue with JSF 2.2 and Glassfish 4. Richfaces is the only installed framework. I cannot switch to earlier JSF or Glassfish. It's a severe problem.
          Hide
          kchung added a comment -

          If the problem appears with JSF 2.2 only, you should file a bug with JSF, so that JSF folks can take a first look.

          Show
          kchung added a comment - If the problem appears with JSF 2.2 only, you should file a bug with JSF, so that JSF folks can take a first look.

            People

            • Assignee:
              kchung
              Reporter:
              nmehner
            • Votes:
              5 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: