Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Fedorenko2017-03-24 21:14:15 +0000
committerJay Arthanareeswaran2017-05-02 04:08:22 +0000
commite0297b61a25828ff1beec6db6a20e5f991ff84d5 (patch)
tree9922b74ff9a47ddf92b6a424a24be8e26f03ae15 /org.eclipse.jdt.compiler.apt.tests
parent4384de995dca1b893a4063d2ab6b634afb840ebe (diff)
downloadeclipse.jdt.core-e0297b61a25828ff1beec6db6a20e5f991ff84d5.tar.gz
eclipse.jdt.core-e0297b61a25828ff1beec6db6a20e5f991ff84d5.tar.xz
eclipse.jdt.core-e0297b61a25828ff1beec6db6a20e5f991ff84d5.zip
Bug 514121: fixed EclipseFileManager leaks open URLClassLoaders
Change-Id: I8c0e3260c8ec12211fbbe28ff7c9e74cf6085a59 Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
Diffstat (limited to 'org.eclipse.jdt.compiler.apt.tests')
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/FileManagerTests.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/FileManagerTests.java b/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/FileManagerTests.java
index f1af4b2ada..36b7079a58 100644
--- a/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/FileManagerTests.java
+++ b/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/FileManagerTests.java
@@ -16,6 +16,7 @@ import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
+import java.net.URLClassLoader;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.HashSet;
@@ -198,4 +199,15 @@ public class FileManagerTests extends TestCase {
fileManager.close();
}
+ public void testBug514121_getClassloader_close() throws Exception {
+ EclipseFileManager fileManager = new EclipseFileManager(Locale.getDefault(), Charset.defaultCharset());
+ List<File> classpath = new ArrayList<>();
+ classpath.add(new File(BatchTestUtils.getPluginDirectoryPath(), "resources/targets/filemanager/dependency.zip"));
+ fileManager.setLocation(javax.tools.StandardLocation.ANNOTATION_PROCESSOR_PATH, classpath);
+ URLClassLoader loader = (URLClassLoader) fileManager
+ .getClassLoader(javax.tools.StandardLocation.ANNOTATION_PROCESSOR_PATH);
+ assertNotNull(loader.findResource("jarresource.txt")); // sanity check
+ fileManager.close();
+ assertNull(loader.findResource("jarresource.txt")); // assert the classloader is closed
+ }
}

Back to the top