diff options
-rw-r--r-- | bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/embeddedequinox/EmbeddedEquinox.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/embeddedequinox/EmbeddedEquinox.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/embeddedequinox/EmbeddedEquinox.java index 6dc33c0fe..3eea18a57 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/embeddedequinox/EmbeddedEquinox.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/embeddedequinox/EmbeddedEquinox.java @@ -37,8 +37,9 @@ public class EmbeddedEquinox { public BundleContext startFramework() { System.setProperty("osgi.framework.useSystemProperties", "false"); + URLClassLoader frameworkLoader = null; try { - URLClassLoader frameworkLoader = new FrameworkClassLoader(frameworkClassPath, this.getClass().getClassLoader()); + frameworkLoader = new FrameworkClassLoader(frameworkClassPath, this.getClass().getClassLoader()); eclipseStarterClazz = frameworkLoader.loadClass("org.eclipse.core.runtime.adaptor.EclipseStarter"); Method setInitialProperties = eclipseStarterClazz.getMethod("setInitialProperties", new Class[] {Map.class}); //$NON-NLS-1$ @@ -50,6 +51,14 @@ public class EmbeddedEquinox { if (t instanceof RuntimeException) throw (RuntimeException) t; throw new RuntimeException(t); + } finally { + if (frameworkLoader != null) { + try { + frameworkLoader.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } } return context; } |