Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0049374
TypeCategorySeverityReproducibilityDate SubmittedLast Update
design defect[Openbravo ERP] A. Platformminorhave not tried2022-05-23 10:322022-05-30 12:48
ReporteralostaleView Statuspublic 
Assigned ToTriage Platform Base 
PrioritynormalResolutionopenFixed in Version
StatusacknowledgedFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned To
Web browser
ModulesCore
Regression levelProduction - Confirmed Stable
Regression date2020-07-20
Regression introduced in releasePR20Q2.2
Regression introduced by commithttps://gitlab.com/openbravo/product/openbravo/-/commit/1cc1f00fa6db5780ba858122a87f1485d8d402e3 [^]
Triggers an Emergency PackNo
Summary

0049374: cannot upload a file to a location that already exists

DescriptionIt is not longer possible upload a file (using org.apache.commons.fileupload.disk.DiskFileItem) if the destination file already exists.

The current commons-fileupload version (1.4) has a regression [1] that prevents it.

This would occur, for example, in this piece of code:

      File tmpFile = File.createTempFile("myFile", "tmp");
      fileItem.write(tmpFile);


---

[1] https://issues.apache.org/jira/browse/FILEUPLOAD-293 [^]
Steps To ReproduceExecute this piece of code (where fileItem is some file uploaded by the user):

      File tmpFile = File.createTempFile("myFile", "tmp");
      fileItem.write(tmpFile);


ERROR:
org.apache.commons.io.FileExistsException: Destination '/tmp/myFileES12761645902496824351tmp' already exists
    at org.apache.commons.io.FileUtils.moveFile(FileUtils.java:2825) ~[commons-io-2.4.jar:2.4]
    at org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:405) ~[commons-fileupload-1.4.jar:1.4]
Proposed SolutionAlthough Apache Commons FileUpload project has fixed the issue in their code repositories [1], they have not published a new version including this fix. Furthermore, according with the discussions in the issue report [2], it seems
they are not planning to do so in a foreseeable future.

So, for now, the temporary workaround is to change the code invoking the affected method to ensure the file does not exist, similarly to what they are doing in their fix [3]:


      File tmpFile = File.createTempFile("myFile", "tmp");
      tmpFile.delete();
      fileItem.write(tmpFile);


---
[1] https://github.com/apache/commons-fileupload/commit/5c2302bbf3859aabf3a719285237f6d0773612b2. [^]
[2] https://issues.apache.org/jira/browse/FILEUPLOAD-293 [^]
[3] https://github.com/apache/commons-fileupload/commit/5c2302bbf3859aabf3a719285237f6d0773612b2#diff-0b9a284d7c4709ab8da7e3de061e2019e68f3a9d597d972bd4b54f4dbd8c2e63R405-R407 [^]
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
caused by feature request 0044937 closedcaristu Update fileUpload library 

-  Notes
(0137633)
alostale (manager)
2022-05-23 14:27

Moved to design defect as it is depends on a new version of the Apache Commons FileUpload that is unlikely to be released in short

- Issue History
Date Modified Username Field Change
2022-05-23 10:32 alostale New Issue
2022-05-23 10:32 alostale Assigned To => Triage Platform Base
2022-05-23 10:32 alostale Modules => Core
2022-05-23 10:32 alostale Triggers an Emergency Pack => No
2022-05-23 10:33 alostale Relationship added caused by 0044937
2022-05-23 10:34 alostale Regression date => 2020-07-20
2022-05-23 10:34 alostale Regression introduced in release => PR20Q2.2
2022-05-23 10:34 alostale Regression introduced by commit => https://gitlab.com/openbravo/product/openbravo/-/commit/1cc1f00fa6db5780ba858122a87f1485d8d402e3 [^]
2022-05-23 10:34 alostale Regression level => Production - Confirmed Stable
2022-05-23 14:27 alostale Note Added: 0137633
2022-05-23 14:27 alostale Type defect => design defect
2022-05-30 12:23 AugustoMauch Assigned To Triage Platform Base => meriem_azaf
2022-05-30 12:23 AugustoMauch Status new => acknowledged
2022-05-30 12:47 AugustoMauch Assigned To meriem_azaf => Triage Platform Base
2022-05-30 12:47 AugustoMauch Status acknowledged => scheduled
2022-05-30 12:48 AugustoMauch Status scheduled => acknowledged


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker