Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-3078

FileUploadException is masked behind WicketRuntimeException and not handled by a Form

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.5-M2.1
    • 1.5-M3
    • wicket, wicket-extensions
    • None
    • Widnows, Jetty 7

    Description

      I have a org.apache.wicket.markup.html.form.Form fileUploadForm, which has:
      fileUploadForm.setMultiPart(true);
      fileUploadForm.setMaxSize(Bytes.kilobytes(150));

      When the form is submitted with a file larger than 150K the following methods are called:
      fileUploadForm -> handleMultiPart -> ServletWebRequest.newMultipartWebRequest((Bytes maxsize) and inside it

      try

      { return new MultipartRequest(getHttpServletRequest(), getFilterPrefix(), maxsize); }

      catch (FileUploadException e)

      { throw new WicketRuntimeException(e); }

      When the file size exceeds the maximum allowed a FileUploadException is thrown, however it is immediately caught and "masked" in a WicketRuntimeException. Inside the handleMultiPart method of the Form there is a catch block for FileUploadException, but the original exception is no longer of type FileUploadException and in this case the form fails to handle it. The result is that instead of an error message informing the user of exceeded limit a wicket stack trace page is displayed.

      I'm not sure if this is part of wicket or wicket-extensions, because it involves classes from the both modules.

      Attachments

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            hok Ivan Vasilev
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: