You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Ralf Hauser (JIRA)" <ji...@apache.org> on 2016/08/17 05:59:20 UTC

[jira] [Commented] (IO-512) ThresholdingOutputStream.thresholdReached() results in FileNotFoundException

    [ https://issues.apache.org/jira/browse/IO-512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15423955#comment-15423955 ] 

Ralf Hauser commented on IO-512:
--------------------------------

if that directory path doesn't change during application run-time, it might be enough to only check for its existence statically upon initial instantiation?

> ThresholdingOutputStream.thresholdReached() results in FileNotFoundException
> ----------------------------------------------------------------------------
>
>                 Key: IO-512
>                 URL: https://issues.apache.org/jira/browse/IO-512
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Streams/Writers
>    Affects Versions: 2.5
>         Environment: java8  debian
>            Reporter: Ralf Hauser
>             Fix For: 2.6
>
>
> I upgraded from commons-io-2.0.1.jar to v2.5 (and fileupload to v1.32)
> and now I get
> java.io.FileNotFoundException: /usr/share/tomcat/temp/dfifp/upload_4d9f8898_1a83_4092_9070_ddf9c15de6d1_00000027.tmp (No such file or directory)
> 	at java.io.FileOutputStream.open(Native Method)
> 	at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
> 	at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
> 	at org.apache.commons.io.output.DeferredFileOutputStream.thresholdReached(DeferredFileOutputStream.java:179)
> In thresholdReached(), the prefix is null, so no temp file is created.
> In the subsequent new FileOutputStream(outputFile), the exception is thrown.
> Suggested fix:
> before new FileOutputStream(outputFile) , add
> FileUtils.forceMkdirParent(outputFile);
> Similar issues reported by others:
> - IO-497
> - https://java.net/jira/browse/GLASSFISH-20581
> - https://jira.sakaiproject.org/si/jira.issueviews:issue-html/SAM-1537/SAM-1537.html



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)