Details
-
Bug
-
Status: Resolved
-
P4
-
Resolution: Fixed
-
None
-
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?
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
- relates to
-
JDK-8213189 Make restricted headers in HTTP Client configurable and remove Date by default
-
- Resolved
-