osgi install action deletes temp file before it gets installed
--------------------------------------------------------------

                 Key: SLING-202
                 URL: https://issues.apache.org/jira/browse/SLING-202
             Project: Sling
          Issue Type: Bug
          Components: Console
            Reporter: Tobias Bocanegra


sometimes it happens that when uploading a new bundle it just doesn't get 
installed.
this problem occurs more often when i'm using for example curl to upload it.
i think the problem is that the request-thread deletes the file before the 
install thread gets hold of it.
when i remove the tmpFile.delete finally block, it works just fine.


Index: 
console-web/src/main/java/org/apache/sling/osgi/console/web/internal/core/InstallAction.java
===================================================================
--- 
console-web/src/main/java/org/apache/sling/osgi/console/web/internal/core/InstallAction.java
        (revision 615347)
+++ 
console-web/src/main/java/org/apache/sling/osgi/console/web/internal/core/InstallAction.java
        (working copy)
@@ -99,10 +99,9 @@
         }
 
         // install the bundle now
-        File tmpFile = null;
         try {
             // copy the data to a file for better processing
-            tmpFile = File.createTempFile("install", ".tmp");
+            File tmpFile = File.createTempFile("install", ".tmp");
             bundleItem.write(tmpFile);
             bundleLocation = "inputstream:" + bundleItem.getName();
 
@@ -110,10 +109,6 @@
         } catch (Exception e) {
             getLog().log(LogService.LOG_ERROR,
                 "Problem accessing uploaded bundle file", e);
-        } finally {
-            if (tmpFile != null) {
-                tmpFile.delete();
-            }
         }
 
         return true;

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to