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

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

XMLWordPrintable

    • b15

      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?

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

              Created:
              Updated:
              Resolved: