Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Duplicate
-
webconsole-4.3.12
-
None
-
None
Description
I get an org.apache.commons.io.FileExistsException when installing bundle from web console.
it only happens when there is v1.4 of commons-fileupload bundle present, works with v.1.3.3
DiskFileItem in v1.4 has code updated for write method which BundleServlet uses for writing temp file.
FileUtils.moveFile(outputFile, file) call is failing here because it does an exists check on temp file created by BundleServlet.
// Code snippet from v1.4 DiskFileItem.write
File outputFile = getStoreLocation(); if (outputFile != null) { // Save the length of the file size = outputFile.length(); /* * The uploaded file is being stored on disk * in a temporary location so move it to the * desired file. */ FileUtils.moveFile(outputFile, file); }
v1.3.3
File outputFile = getStoreLocation(); if (outputFile != null) { // Save the length of the file size = outputFile.length(); /* * The uploaded file is being stored on disk * in a temporary location so move it to the * desired file. */ if (!outputFile.renameTo(file)) { BufferedInputStream in = null; BufferedOutputStream out = null; try { in = new BufferedInputStream( new FileInputStream(outputFile)); out = new BufferedOutputStream( new FileOutputStream(file)); IOUtils.copy(in, out); }
Attachments
Issue Links
- duplicates
-
FELIX-6037 Commons FileUpload 1.4 breaks bundle uploads
- Closed