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

Reduce allocations in URLStreamHandler.parseURL for some cases

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 15
    • None
    • core-libs
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: