You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2022/09/28 20:07:38 UTC
[httpcomponents-client] 01/05: Use Objects.toString() instead of String type cast
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git
commit d100edf411d57efe0bb5e780c9238e2e14b45aac
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Sep 27 08:36:19 2022 -0400
Use Objects.toString() instead of String type cast
---
.../java/org/apache/hc/client5/http/ssl/TlsSessionValidator.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/TlsSessionValidator.java b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/TlsSessionValidator.java
index 99d110e60..76541ff46 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/TlsSessionValidator.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/TlsSessionValidator.java
@@ -32,6 +32,7 @@ import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.Objects;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLException;
@@ -73,7 +74,7 @@ final class TlsSessionValidator {
final List<String> altNames = new ArrayList<>();
for (final List<?> aC : altNames1) {
if (!aC.isEmpty()) {
- altNames.add((String) aC.get(1));
+ altNames.add(Objects.toString(aC.get(1), null));
}
}
log.debug(" peer alternative names: {}", altNames);
@@ -86,7 +87,7 @@ final class TlsSessionValidator {
final List<String> altNames = new ArrayList<>();
for (final List<?> aC : altNames2) {
if (!aC.isEmpty()) {
- altNames.add((String) aC.get(1));
+ altNames.add(Objects.toString(aC.get(1), null));
}
}
log.debug(" issuer alternative names: {}", altNames);