[
https://issues.apache.org/jira/browse/FILEUPLOAD-252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14239397#comment-14239397
]
Sebb commented on FILEUPLOAD-252:
---------------------------------
And
http://svn.apache.org/r1643123
> DiskFileItem#write can lose original IO error
> ---------------------------------------------
>
> Key: FILEUPLOAD-252
> URL: https://issues.apache.org/jira/browse/FILEUPLOAD-252
> Project: Commons FileUpload
> Issue Type: Bug
> Reporter: Sebb
> Fix For: 1.4
>
>
> The method DiskFileItem#write has the following code:
> {code}
> FileOutputStream fout = null;
> try {
> fout = new FileOutputStream(file);
> fout.write(get());
> } finally {
> if (fout != null) {
> fout.close();
> }
> }
> {code}
> If the write fails and then the close fails, the write failure will be masked
> by the close error. It might be better to write the code as:
> {code}
> FileOutputStream fout = null;
> try {
> fout = new FileOutputStream(file);
> fout.write(get());
> fout.close();
> } finally {
> IOUtils.closeQuietly(fout);
> }
> {code}
> This would ensure that the first error was reported.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)