FileUploadException is masked behind WicketRuntimeException and not handled by 
a Form
-------------------------------------------------------------------------------------

                 Key: WICKET-3078
                 URL: https://issues.apache.org/jira/browse/WICKET-3078
             Project: Wicket
          Issue Type: Bug
          Components: wicket, wicket-extensions
         Environment: Widnows, Jetty 7
            Reporter: Ivan Vasilev


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.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to