karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject [karaf] branch master updated: [KARAF-6276] Delete update file in finally block
Date Wed, 15 May 2019 05:32:31 GMT
This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/master by this push:
     new 1f11d4c  [KARAF-6276] Delete update file in finally block
     new e7f5c1f  Merge pull request #837 from htreu/karaf-6276
1f11d4c is described below

commit 1f11d4c2432c2eb5bbdbf3556a242dea71ec21ab
Author: Henning Treu <henning.treu@instana.com>
AuthorDate: Tue May 14 10:06:36 2019 +0200

    [KARAF-6276] Delete update file in finally block
---
 .../karaf/features/internal/service/BundleInstallSupportImpl.java | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/BundleInstallSupportImpl.java
b/features/core/src/main/java/org/apache/karaf/features/internal/service/BundleInstallSupportImpl.java
index 5b0c7e6..b05425c 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/service/BundleInstallSupportImpl.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/BundleInstallSupportImpl.java
@@ -140,13 +140,17 @@ public class BundleInstallSupportImpl implements BundleInstallSupport
{
 
     @Override
     public void updateBundle(Bundle bundle, String uri, InputStream is) throws BundleException
{
+        File file = null;
         // We need to wrap the bundle to insert a Bundle-UpdateLocation header
         try {
-            File file = BundleUtils.fixBundleWithUpdateLocation(is, uri);
+            file = BundleUtils.fixBundleWithUpdateLocation(is, uri);
             bundle.update(new FileInputStream(file));
-            file.delete();
         } catch (IOException e) {
             throw new BundleException("Unable to update bundle", e);
+        } finally {
+            if (file != null) {
+                file.delete();
+            }
         }
     }
 


Mime
View raw message