You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Maurizio Cucchiara (JIRA)" <ji...@apache.org> on 2011/01/23 04:15:43 UTC

[jira] Commented: (WW-3562) FileUploadInterceptor: File not uploaded when file is empty (0 bytes)

    [ https://issues.apache.org/jira/browse/WW-3562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12985235#action_12985235 ] 

Maurizio Cucchiara commented on WW-3562:
----------------------------------------

This happen because commons file upload uses a deferred output stream (dos) in order to write the empty file. 
>From javadocs about dos [1]:
An output stream which will retain data in memory until a specified threshold is reached, and only then commit it to disk. If the stream is closed before the threshold is reached, the data will not be written to disk at all. [...]

Although struts uses 0 as threshold, the empty file doesn't reach it (I tried to use -1 as value but unsuccessfully).


[1] http://commons.apache.org/io/api-release/org/apache/commons/io/output/DeferredFileOutputStream.html

> FileUploadInterceptor: File not uploaded when file is empty (0 bytes)
> ---------------------------------------------------------------------
>
>                 Key: WW-3562
>                 URL: https://issues.apache.org/jira/browse/WW-3562
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Interceptors
>    Affects Versions: 2.2.1.1
>         Environment: Windows 7 64-bit or Windows XP with either Tomcat or Jetty Web Container
>            Reporter: Burton Rhodes
>            Assignee: Maurizio Cucchiara
>            Priority: Minor
>         Attachments: StrutsUploadTest.zip
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> When a user uploads a file that is emtpy (0 bytes), the actual file is not copied to the web container's "work" directory.  All other information about the file is copied though (e.g. contentType, fileName).  Although the file is emtpy file.exist() should still equal "true".  I have attached a demo app that demostrates the issue.  IMO, an empty file should be treated just like a non-empty file.

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