Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.5
-
None
-
java8 debian
Description
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: