http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1440
*** shadow/1440 Fri Apr 20 12:30:35 2001
--- shadow/1440.tmp.9544 Fri Apr 20 12:30:35 2001
***************
*** 0 ****
--- 1,31 ----
+ +============================================================================+
+ | AntClassLoader incorrectly implements getResource(). |
+ +----------------------------------------------------------------------------+
+ | Bug #: 1440 Product: Ant |
+ | Status: NEW Version: 1.3 |
+ | Resolution: Platform: All |
+ | Severity: Normal OS/Version: All |
+ | Priority: Component: Core |
+ +----------------------------------------------------------------------------+
+ | Assigned To: [EMAIL PROTECTED] |
+ | Reported By: [EMAIL PROTECTED] |
+ | CC list: Cc: |
+ +----------------------------------------------------------------------------+
+ | URL: |
+ +============================================================================+
+ | DESCRIPTION |
+ When using ant and junit together, I noticed that calls to getClass
+ ().getResource("xyz") would always return null while calls to getClass
+ ().getResourceAsStream("xyz") would work just fine. Looking at the
+ java.lang.ClassLoader source code revealed that JDK 1.2 added a method called
+ findResource(String) which is supposed to be overridden by subclasses. If a
+ subclass does not override this method, the default implementation simply
+ returns null. Since AntClassLoader is explicitly overriding
getResourceAsStream
+ (String), that call works, but calls to getResource(String) end up calling
the
+ default findResource(String) method and always return null. I suspect that
if
+ the code in AntClassLoader.getResourceAsStream(String) should be moved into
+ AntClassLoader.findResource(String) and then
AntClassLoader.getResourceAsStream
+ (String) no longer necessary. This will not work with JDK 1.1 though. I
don't
+ know what the recommended approach for JDK 1.1/1.2 cross-compatible
+ ClassLoaders is, but probably you would override getResource(String) and call
+ it from getResourceAsStream(String).