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

Reduce allocations in URLStreamHandler.parseURL for some cases

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 15
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b18

      Description

      ===== PATCH =====
      diff --git a/src/java.base/share/classes/java/net/URLStreamHandler.java b/src/java.base/share/classes/java/net/URLStreamHandler.java
      --- a/src/java.base/share/classes/java/net/URLStreamHandler.java
      +++ b/src/java.base/share/classes/java/net/URLStreamHandler.java
      @@ -266,8 +266,8 @@
                                spec.substring(start, limit);

                   } else {
      - String separator = (authority != null) ? "/" : "";
      - path = separator + spec.substring(start, limit);
      + path = spec.substring(start, limit);
      + path = (authority != null) ? "/" + path : path;
                   }
               } else if (queryOnly && path != null) {
                   int ind = path.lastIndexOf('/');

      Suggested by Christoph Dreis: https://mail.openjdk.java.net/pipermail/core-libs-dev/2020-April/065635.html

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: