You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Carsten Ziegeler (JIRA)" <ji...@apache.org> on 2019/08/12 07:34:00 UTC
[jira] [Commented] (FELIX-6167)
org.apache.commons.io.FileExistsException when installing bundle from web
console
[ https://issues.apache.org/jira/browse/FELIX-6167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16904930#comment-16904930 ]
Carsten Ziegeler commented on FELIX-6167:
-----------------------------------------
This looks like a duplicate of FELIX-6037
> org.apache.commons.io.FileExistsException when installing bundle from web console
> ----------------------------------------------------------------------------------
>
> Key: FELIX-6167
> URL: https://issues.apache.org/jira/browse/FELIX-6167
> Project: Felix
> Issue Type: Bug
> Components: Web Console
> Affects Versions: webconsole-4.3.12
> Reporter: Rakesh Kumar
> Priority: Major
>
> 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*
> {code:java}
> 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);
> }{code}
> v1.3.3
> {code:java}
> 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);
> }{code}
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)