From bea19bf7820ebfe7561f80ab250ccec07bb3538f Mon Sep 17 00:00:00 2001 From: Evgeny Mandrikov Date: Mon, 21 Mar 2011 13:59:56 +0300 Subject: SONAR-2276 BootstrapClassLoader should not load resources from parent ClassLoader --- .../batch/bootstrapper/BootstrapClassLoader.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'sonar-batch-bootstrapper') diff --git a/sonar-batch-bootstrapper/src/main/java/org/sonar/batch/bootstrapper/BootstrapClassLoader.java b/sonar-batch-bootstrapper/src/main/java/org/sonar/batch/bootstrapper/BootstrapClassLoader.java index 1bf933ea5c7..f0c678f9abd 100644 --- a/sonar-batch-bootstrapper/src/main/java/org/sonar/batch/bootstrapper/BootstrapClassLoader.java +++ b/sonar-batch-bootstrapper/src/main/java/org/sonar/batch/bootstrapper/BootstrapClassLoader.java @@ -19,8 +19,10 @@ */ package org.sonar.batch.bootstrapper; +import java.io.IOException; import java.net.URL; import java.net.URLClassLoader; +import java.util.Enumeration; /** * Special {@link URLClassLoader} to execute Sonar, which restricts loading from parent. @@ -90,4 +92,22 @@ public class BootstrapClassLoader extends URLClassLoader { return c; } + /** + * Unlike {@link URLClassLoader#getResource(String)} don't return resource from parent. + * See http://jira.codehaus.org/browse/SONAR-2276 + */ + @Override + public URL getResource(String name) { + return findResource(name); + } + + /** + * Unlike {@link URLClassLoader#getResources(String)} don't return resources from parent. + * See http://jira.codehaus.org/browse/SONAR-2276 + */ + @Override + public Enumeration getResources(String name) throws IOException { + return findResources(name); + } + } -- cgit v1.2.3