You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Tobias Bocanegra (JIRA)" <ji...@apache.org> on 2008/01/25 22:34:34 UTC

[jira] Created: (SLING-202) osgi install action deletes temp file before it gets installed

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.


[jira] Closed: (SLING-202) osgi install action deletes temp file before it gets installed

Posted by "Tobias Bocanegra (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-202?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tobias Bocanegra closed SLING-202.
----------------------------------


> 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
>            Assignee: Felix Meschberger
>             Fix For: 2.0.0
>
>
> 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.


[jira] Resolved: (SLING-202) osgi install action deletes temp file before it gets installed

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-202?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger resolved SLING-202.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0

I implemented a slightly different solution to go to great extends to really remove the temporary file in Rev. 616269:

   * If the temporary file cannot be written at all, remove any left overs
   * Otherwise, if the symbolic name cannot be extracted, remove the file before leaving
   * Otherwise have the background thread remove the file after installation or update

Please close this issue if this solves your problem. Thanks.

> 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
>            Assignee: Felix Meschberger
>             Fix For: 2.0.0
>
>
> 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.


[jira] Assigned: (SLING-202) osgi install action deletes temp file before it gets installed

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-202?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger reassigned SLING-202:
---------------------------------------

    Assignee: Felix Meschberger

> 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
>            Assignee: Felix Meschberger
>
> 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.