You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2019/05/15 05:32:31 UTC
[karaf] branch master updated: [KARAF-6276] Delete update file in
finally block
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 <he...@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();
+ }
}
}