Improve URL protocol lower casing

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P5
    • 20
    • Affects Version/s: None
    • Component/s: 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

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

              Created:
              Updated:
              Resolved: