summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Bull2013-09-03 15:19:04 (EDT)
committerIan Bull2013-09-03 15:19:04 (EDT)
commit9c7ce52dc5b0c19d99464f7b871e27d864028878 (patch)
treefff2f39ea65ce5cc570c320c67be7cc42f96f401
parentcacbe7d2a99c31be313baa5da2e4b52ac885965c (diff)
downloadrt.equinox.p2-9c7ce52dc5b0c19d99464f7b871e27d864028878.zip
rt.equinox.p2-9c7ce52dc5b0c19d99464f7b871e27d864028878.tar.gz
rt.equinox.p2-9c7ce52dc5b0c19d99464f7b871e27d864028878.tar.bz2
Added a suppress warning instead of closing the stream.I20130903-2000
TL;DR Reflection messes with the the compiler's resource leak detection. Because much of the equinox test code happens reflectively, we can't actually close the stream (as the compiler wants us to). This keeps the stream open so the shutdown method can be invoked.
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/embeddedequinox/EmbeddedEquinox.java13
1 files changed, 3 insertions, 10 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 3eea18a..9b590f9 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,9 +37,10 @@ public class EmbeddedEquinox {
public BundleContext startFramework() {
System.setProperty("osgi.framework.useSystemProperties", "false");
- URLClassLoader frameworkLoader = null;
try {
- frameworkLoader = new FrameworkClassLoader(frameworkClassPath, this.getClass().getClassLoader());
+ @SuppressWarnings("resource")
+ // For some reason when you close the framework loader, tests fail!
+ URLClassLoader 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$
@@ -51,14 +52,6 @@ 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;
}