-
CSR
-
Resolution: Approved
-
P4
-
None
-
behavioral
-
low
-
It is possible that some code is catching the undocumented IllegalArgumentException and treating it in a specific way.
-
Java API
-
Implementation
Summary
Modify the implementation of java.net.URLClassLoader
such that an undocumented IllegalArgumentException
is no longer thrown from the getResource[s] and findResource[s] methods.
Problem
The javadocs for URLClassLoader.findResource()
, and those inherited from ClassLoader.getResource()
, indicate that null
will be returned if there are problems getting a resource. However, the implementation throws an undocumented IllegalArgumentException
under specific conditions (when getting a resource named with a Windows path, "c:/windows" from a URL ending in '/'). This can cause incorrect behavior (most likely on Windows systems). An example of such a problem was discovered in Spring Framework, necessitating a workaround.
Similarly, an IllegalArgumentException
can occur when using Enumerations returned from findResources()
and getResources()
.
Solution
Modify the implementation of java.net.URLClassLoader
to not throw IllegalArgumentException
when finding resources.
Specification
No specification changes
- csr of
-
JDK-8262277 URLClassLoader.getResource throws undocumented IllegalArgumentException
-
- Closed
-