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

Potential bug in jdk.internal.net.http.common.Utils.CONTEXT_RESTRICTED

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b15

      Description

      SonarCloud reports:
        Ensure this "Optional" could never be null and remove this null-check.

      Here:
       
          public static final BiPredicate<String, String> CONTEXT_RESTRICTED(HttpClient client) {
              return (k, v) -> client.authenticator() == null || // <---- here
                      ! (k.equalsIgnoreCase("Authorization")
                              && k.equalsIgnoreCase("Proxy-Authorization"));
          }

      client.authenticator() returns Optional<Authenticator>, so maybe client.authenticator().isPresent() was intended?

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              michaelm Michael McMahon
              Reporter:
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: