The jdk.internal.loader.URLClassPath is used by ClassLoader implementations in the JDK to locate resources within a classpath constructed out of one or more URLs. The internal implementation of URLClassPath does the necessary work to create appropriate resource loaders out of these individual URLs. Any exceptions that occur when constructing these internal loaders is handled internally within the URLClassPath implementation and such failing loaders won't be able to locate resources, but other loaders that were successfully constructed maybe able to.
It has been noticed that in a certain specific case, when trying to construct the internal loader, a failure to parse a URL propagates an IllegalArgumentException to the callers of URLClassPath:
Exception in thread "main" java.lang.IllegalArgumentException: Error decoding percent encoded characters
at java.base/sun.net.www.ParseUtil.decode(ParseUtil.java:221)
at java.base/jdk.internal.loader.URLClassPath$FileLoader.<init>(URLClassPath.java:906)
at java.base/jdk.internal.loader.URLClassPath.getLoader(URLClassPath.java:451)
at java.base/jdk.internal.loader.URLClassPath.getLoader(URLClassPath.java:407)
at java.base/jdk.internal.loader.URLClassPath.getResource(URLClassPath.java:329)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:688)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:620)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:578)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:490)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:545)
This should be fixed to handle the IllegalArgumentException internally in the implementation of the URLClassPath.
It has been noticed that in a certain specific case, when trying to construct the internal loader, a failure to parse a URL propagates an IllegalArgumentException to the callers of URLClassPath:
Exception in thread "main" java.lang.IllegalArgumentException: Error decoding percent encoded characters
at java.base/sun.net.www.ParseUtil.decode(ParseUtil.java:221)
at java.base/jdk.internal.loader.URLClassPath$FileLoader.<init>(URLClassPath.java:906)
at java.base/jdk.internal.loader.URLClassPath.getLoader(URLClassPath.java:451)
at java.base/jdk.internal.loader.URLClassPath.getLoader(URLClassPath.java:407)
at java.base/jdk.internal.loader.URLClassPath.getResource(URLClassPath.java:329)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:688)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:620)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:578)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:490)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:545)
This should be fixed to handle the IllegalArgumentException internally in the implementation of the URLClassPath.
- relates to
-
JDK-8258246 sun.net.www.ParseUtil.decode throws java.lang.IllegalArgumentException: Error decoding percent encoded characters
-
- Open
-
- links to
-
Commit(master) openjdk/jdk/81c44e5e
-
Review(master) openjdk/jdk/22351