-
Bug
-
Resolution: Fixed
-
P4
-
None
-
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?
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?
- relates to
-
JDK-8323292 Improper handling of Proxy-Authorization header
-
- Open
-
-
JDK-8213189 Make restricted headers in HTTP Client configurable and remove Date by default
-
- Resolved
-