[ 
https://issues.apache.org/jira/browse/TOMAHAWK-1305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12635703#action_12635703
 ] 

Paul Rivera commented on TOMAHAWK-1305:
---------------------------------------

This issue is similar to TOMAHAWK-6.

I was able to replicate this issue locally with tomahawk 1.1.8-SNAPSHOT.  No 
messages shown in h:message even though the size was greater than 
uploadMaxFileSize.

I did some investigation and found out that:
  - Once commons upload determines that the size of the file being uploaded is 
greater than uploadMaxFileSize, it throws a SizeLimitExceededException.  This 
prevents it from doing further processing to read the request parameters.  (see 
org.apache.commons.fileupload.FileUploadBase)
  - RestoreViewExecutor looks for a request parameter named 
javax.faces.ViewState.  Since the request parameters were not read as mentioned 
above, javax.faces.ViewState will be null when RestoreViewExecutor looks for 
it.  RestoreViewExecutor finds no view to restore so it will treat it as a new 
page.  It will call facesContext.renderResponse() to skip the other phases and 
proceed with the render response phase immediately.
  - The code that adds a FacesMessage when the size limit is exceeded is inside 
AbstractHtmlInputFileUpload.validateValue(FacesContext context, Object 
convertedValue).  This method only gets called during the validation phase, 
which is skipped as mentioned above.  This is why there is no message shown in 
h:message.

I'm still thinking of a good way to fix this.  Maybe you have some ideas?

> No error when file is uploaded larger than uploadMaxFileSize
> ------------------------------------------------------------
>
>                 Key: TOMAHAWK-1305
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1305
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: File Upload
>    Affects Versions: 1.1.7-SNAPSHOT
>            Reporter: Gertjan van Oosten
>
> When a file is uploaded that is larger than the uploadMaxFileSize, the upload 
> is ignored but no error is shown.
> Reproducible with the fileupload example:
>   http://www.irian.at/myfacesexamples/fileupload.jsf
> Be patient, you need a file larger than 100 MBytes.

-- 
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