Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Waibel2015-06-01 14:28:18 -0400
committerFlorian Waibel2015-06-01 14:28:18 -0400
commit78396af75d1ecc62ad3262a7a0d5db684e1f04aa (patch)
treea69ae59de80df82c9dc5509bd9f3052fa3c97bba
parentd4f1949c92ceda081d99b638d03ae6360a7d056c (diff)
downloadorg.eclipse.virgo.kernel-78396af75d1ecc62ad3262a7a0d5db684e1f04aa.tar.gz
org.eclipse.virgo.kernel-78396af75d1ecc62ad3262a7a0d5db684e1f04aa.tar.xz
org.eclipse.virgo.kernel-78396af75d1ecc62ad3262a7a0d5db684e1f04aa.zip
Closes resource leak in test OSGi framework launcher
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/equinox/AbstractOsgiFrameworkLaunchingTests.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/equinox/AbstractOsgiFrameworkLaunchingTests.java b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/equinox/AbstractOsgiFrameworkLaunchingTests.java
index 87dfc1ce..68c514bd 100644
--- a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/equinox/AbstractOsgiFrameworkLaunchingTests.java
+++ b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/equinox/AbstractOsgiFrameworkLaunchingTests.java
@@ -14,7 +14,10 @@ package org.eclipse.virgo.kernel.userregion.internal.equinox;
import static org.junit.Assert.assertTrue;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
import java.net.URI;
import java.util.HashSet;
import java.util.Map;
@@ -138,7 +141,10 @@ public abstract class AbstractOsgiFrameworkLaunchingTests {
RepositoryFactory repositoryFactory = bundleContext.getService(repositoryFactoryServiceReference);
Properties repositoryProperties = new Properties();
- repositoryProperties.load(new FileReader(new File(getRepositoryConfigDirectory(), "repository.properties")));
+
+ try (InputStream properties = new FileInputStream(new File(getRepositoryConfigDirectory(), "repository.properties"))) {
+ repositoryProperties.load(properties);
+ }
Set<ArtifactBridge> artifactBridges = new HashSet<ArtifactBridge>();
artifactBridges.add(new BundleBridge(new StubHashGenerator()));

Back to the top