From f32ae813fcc0f10fa3bc6db3759e4aecb7725977 Mon Sep 17 00:00:00 2001 From: Simon Kitching Date: Sun, 16 Apr 2006 21:30:19 +0000 Subject: [PATCH] Remove recently-added implementation of getResources. As javadoc already stated, this can't be implemented because in java 1.4 getResources is final :-(. Unit tests that care about getResources() order will just have to use parentFirst=true. git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@394563 13f79535-47bb-0310-9956-ffa450edef68 --- .../commons/logging/PathableClassLoader.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/test/org/apache/commons/logging/PathableClassLoader.java b/src/test/org/apache/commons/logging/PathableClassLoader.java index 4553745..d8c0ef4 100644 --- a/src/test/org/apache/commons/logging/PathableClassLoader.java +++ b/src/test/org/apache/commons/logging/PathableClassLoader.java @@ -98,6 +98,10 @@ public class PathableClassLoader extends URLClassLoader { * child-first lookup instead, to allow the components to override libs * which are visible in shared classloaders provided by the container. *

+ * Note that the method getResources always behaves as if parentFirst=true, + * because of limitations in java 1.4; see the javadoc for method + * getResourcesInOrder for details. + *

* This value defaults to true. */ public void setParentFirst(boolean state) { @@ -237,11 +241,14 @@ public class PathableClassLoader extends URLClassLoader { } /** - * Same as parent class method except that when parentFirst is false - * any resources in the local classpath are returned before resources - * in the parent. + * Emulate a proper implementation of getResources which respects the + * setting for parentFirst. + *

+ * Note that it's not possible to override the inherited getResources, as + * it's declared final in java1.4 (thought that's been removed for 1.5). + * The inherited implementation always behaves as if parentFirst=true. */ - public Enumeration getResources(String name) throws IOException { + public Enumeration getResourcesInOrder(String name) throws IOException { if (parentFirst) { return super.getResources(name); } else {