Tapestry
  1. Tapestry
  2. TAPESTRY-957

When trying to upload a file that is greater that the set maxSize an uncatchable exception is thrown

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 4.0.1
    • Fix Version/s: 4.1.1
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      OS: Windows XP
      WebServer: Tomcat
      IDE: Eclipse

      Description

      Following the example as given on the tapestry web-site I attempted to set the maximum size of file that could be uploaded on a given web page (using the @Upload component), and after some initial difficulties I finally managed to get it to work, well kind of work. The problem is that when it correctly detects that the file is greater than a permitted size it throws an uncatchable exception (I have a try-catch-finally around my upload java code).

      The exception thrown was :

      type Exception report

      message

      description The server encountered an internal error () that prevented it from fulfilling this request.

      exception

      javax.servlet.ServletException: Unable to decode multipart encoded request: the request was rejected because its size (330476) exceeds the configured maximum (300000)
      net.sf.acegisecurity.intercept.web.SecurityEnforcementFilter.doFilter(SecurityEnforcementFilter.java:233)
      net.sf.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120)
      net.sf.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:143)
      net.sf.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120)
      net.sf.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:324)
      net.sf.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120)
      net.sf.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:220)
      net.sf.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120)

      root cause

      org.apache.hivemind.ApplicationRuntimeException: Unable to decode multipart encoded request: the request was rejected because its size (330476) exceeds the configured maximum (300000)
      org.apache.tapestry.multipart.MultipartDecoderImpl.decode(MultipartDecoderImpl.java:56)
      $ServletMultipartDecoder_10b5c745c6f.decode($ServletMultipartDecoder_10b5c745c6f.java)
      $ServletMultipartDecoder_10b5c745c70.decode($ServletMultipartDecoder_10b5c745c70.java)
      org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:50)
      $ServletRequestServicerFilter_10b5c745cad.service($ServletRequestServicerFilter_10b5c745cad.java)
      $ServletRequestServicer_10b5c745cb5.service($ServletRequestServicer_10b5c745cb5.java)
      org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53)
      $ServletRequestServicerFilter_10b5c745cb1.service($ServletRequestServicerFilter_10b5c745cb1.java)
      $ServletRequestServicer_10b5c745cb5.service($ServletRequestServicer_10b5c745cb5.java)
      $ServletRequestServicer_10b5c745ca7.service($ServletRequestServicer_10b5c745ca7.java)
      org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:123)
      org.apache.tapestry.ApplicationServlet.doPost(ApplicationServlet.java:168)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      net.sf.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:108)
      net.sf.acegisecurity.intercept.web.SecurityEnforcementFilter.doFilter(SecurityEnforcementFilter.java:197)
      net.sf.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120)
      net.sf.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:143)
      net.sf.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120)
      net.sf.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:324)
      net.sf.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120)
      net.sf.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:220)
      net.sf.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120)

      root cause

      org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (330476) exceeds the configured maximum (300000)
      org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:310)
      org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:116)
      org.apache.tapestry.multipart.MultipartDecoderImpl.decode(MultipartDecoderImpl.java:50)
      $ServletMultipartDecoder_10b5c745c6f.decode($ServletMultipartDecoder_10b5c745c6f.java)
      $ServletMultipartDecoder_10b5c745c70.decode($ServletMultipartDecoder_10b5c745c70.java)
      org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:50)
      $ServletRequestServicerFilter_10b5c745cad.service($ServletRequestServicerFilter_10b5c745cad.java)
      $ServletRequestServicer_10b5c745cb5.service($ServletRequestServicer_10b5c745cb5.java)
      org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53)
      $ServletRequestServicerFilter_10b5c745cb1.service($ServletRequestServicerFilter_10b5c745cb1.java)
      $ServletRequestServicer_10b5c745cb5.service($ServletRequestServicer_10b5c745cb5.java)
      $ServletRequestServicer_10b5c745ca7.service($ServletRequestServicer_10b5c745ca7.java)
      org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:123)
      org.apache.tapestry.ApplicationServlet.doPost(ApplicationServlet.java:168)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      net.sf.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:108)
      net.sf.acegisecurity.intercept.web.SecurityEnforcementFilter.doFilter(SecurityEnforcementFilter.java:197)
      net.sf.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120)
      net.sf.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:143)
      net.sf.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120)
      net.sf.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:324)
      net.sf.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120)
      net.sf.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:220)
      net.sf.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120)

      note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.

        Activity

        Hide
        Artur Zezula added a comment -

        I guess that Commons FileUpload works fine. Reading of stream is stopped and exception is thrown. There shall be found solution how to handle such cases in Tapestry based application.

        Show
        Artur Zezula added a comment - I guess that Commons FileUpload works fine. Reading of stream is stopped and exception is thrown. There shall be found solution how to handle such cases in Tapestry based application.
        Hide
        Jesse Kuhnert added a comment -

        Unfortunately it looks like this problem is in the jakarta commons FileUpload library. While it does allow setting a max fileupload size it doesn't provide any means to gracefully recover from a situation where the size is exceeded. Optimally it would somehow set the error but allow the rest of the form submission input stream to continue to be processed.

        I would bring this up as a real issue with the FileUpload team. (probably in this same jira instance)

        I have enabled the client side "required" validation to work on this component in limited utility now.

        Show
        Jesse Kuhnert added a comment - Unfortunately it looks like this problem is in the jakarta commons FileUpload library. While it does allow setting a max fileupload size it doesn't provide any means to gracefully recover from a situation where the size is exceeded. Optimally it would somehow set the error but allow the rest of the form submission input stream to continue to be processed. I would bring this up as a real issue with the FileUpload team. (probably in this same jira instance) I have enabled the client side "required" validation to work on this component in limited utility now.

          People

          • Assignee:
            Unassigned
            Reporter:
            Brian Long
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development