When a URLClassLoader is determining if one of the URLs in its path refers to a directory or a JAR file, it looks for a trailing slash at the end of the entire URL, including the query component, if any [because URLClassPath.getLoader(URL) uses URL.getFile() instead of URL.getPath()]. Admittedly, this behavior does seem to obey the letter of the URLClassLoader specification:
Any URL that ends with a '/' is assumed to refer to a directory.
Otherwise, the URL is assumed to refer to a JAR file which will be
opened as needed.
But it seems contrary to the intent, given that for URLs that are determined to refer to directories, a query component will be ignored as part of resolving the relative resource URL against the base URL anyway.
Then again, this issue seems unlikely to adversely affect cases in practice that would otherwise have worked-- hence the P5/S5. See 4913482 for a case that actually had been taking advantage of this bug/feature (until 4330195 was fixed).
Any URL that ends with a '/' is assumed to refer to a directory.
Otherwise, the URL is assumed to refer to a JAR file which will be
opened as needed.
But it seems contrary to the intent, given that for URLs that are determined to refer to directories, a query component will be ignored as part of resolving the relative resource URL against the base URL anyway.
Then again, this issue seems unlikely to adversely affect cases in practice that would otherwise have worked-- hence the P5/S5. See 4913482 for a case that actually had been taking advantage of this bug/feature (until 4330195 was fixed).
- relates to
-
JDK-4913482 REGRESSION: codebase URL that worked in jdk1.3.x isn't working anymore
-
- Closed
-