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

Improve URL protocol lower casing

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P5 P5
    • 20
    • None
    • core-libs
    • None
    • b18

      When creating URL objects we have a small optimization in place that avoids initializing Locale on bootstrap:

          static String toLowerCase(String protocol) {
              if (protocol.equals("jrt") || protocol.equals("file") || protocol.equals("jar")) {
                  return protocol;
              } else {
                  return protocol.toLowerCase(Locale.ROOT);
              }
          }

      This could be improved in two ways:
      - move it to sun.net.util.URLUtil to facilitate reuse
      - return "jrt", "file" or "jar" respectively to get canonicalization of the protocol string for free, saving memory for any URL we hold on to for an extended time

            redestad Claes Redestad
            redestad Claes Redestad
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: