From 39a9d9971074c2d219df364afb2638146804d5ac Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Tue, 26 Jul 2016 21:49:33 +0200 Subject: [PATCH] #1508 - Only close the classloader if its ours --- pmd-core/src/main/java/net/sourceforge/pmd/PMD.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java b/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java index 43b5490b5f..c3d1ee3069 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java @@ -40,6 +40,7 @@ import net.sourceforge.pmd.processor.MonoThreadProcessor; import net.sourceforge.pmd.processor.MultiThreadProcessor; import net.sourceforge.pmd.renderers.Renderer; import net.sourceforge.pmd.stat.Metric; +import net.sourceforge.pmd.util.ClasspathClassLoader; import net.sourceforge.pmd.util.FileUtil; import net.sourceforge.pmd.util.IOUtil; import net.sourceforge.pmd.util.SystemUtils; @@ -370,7 +371,9 @@ public class PMD { new MonoThreadProcessor(configuration).processFiles(ruleSetFactory, files, ctx, renderers); } - IOUtil.tryCloseClassLoader(configuration.getClassLoader()); + if (configuration.getClassLoader() instanceof ClasspathClassLoader) { + IOUtil.tryCloseClassLoader(configuration.getClassLoader()); + } } private static void sortFiles(final PMDConfiguration configuration, final List files) {