Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4915051

URLClassLoader considers query component when looking for trailing slash

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P5 P5
    • None
    • 1.4.0
    • core-libs
    • None
    • generic
    • generic

      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).

            michaelm Michael McMahon
            peterjones Peter Jones (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: