]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2276 BootstrapClassLoader should not load resources from parent ClassLoader
authorEvgeny Mandrikov <mandrikov@gmail.com>
Mon, 21 Mar 2011 10:59:56 +0000 (13:59 +0300)
committerEvgeny Mandrikov <mandrikov@gmail.com>
Tue, 29 Mar 2011 21:26:57 +0000 (01:26 +0400)
sonar-batch-bootstrapper/src/main/java/org/sonar/batch/bootstrapper/BootstrapClassLoader.java

index 1bf933ea5c7098a86ca212317f9f694b683d7596..f0c678f9abdce8b642decd0c7ca6d4a420577c2c 100644 (file)
  */
 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<URL> getResources(String name) throws IOException {
+    return findResources(name);
+  }
+
 }