Ralf Hauser created IO-512: ------------------------------ Summary: 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
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)