From c58288c9af339343a4433888a73f70669c2556ff Mon Sep 17 00:00:00 2001 From: "Gary D. Gregory" Date: Tue, 28 Mar 2017 18:50:01 +0000 Subject: [PATCH] [HTTPCLIENT-1836] DefaultHostnameVerifier#getSubjectAltNames(X509Certificate) throws java.lang.ClassCastException. Contributed by Gary Gregory , Ilian Iliev --- RELEASE_NOTES.txt | 2 ++ .../org/apache/http/conn/ssl/DefaultHostnameVerifier.java | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index 95ceac3cd..41373b981 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -17,6 +17,8 @@ Changelog: * [HTTPCLIENT-1816] Update Apache Commons Codec 1.9 to 1.10. Contributed by Gary Gregory +* [HTTPCLIENT-1836] DefaultHostnameVerifier#getSubjectAltNames(X509Certificate) throws java.lang.ClassCastException. + Contributed by Gary Gregory , Ilian Iliev Release 4.5.3 ------------------- diff --git a/httpclient/src/main/java/org/apache/http/conn/ssl/DefaultHostnameVerifier.java b/httpclient/src/main/java/org/apache/http/conn/ssl/DefaultHostnameVerifier.java index 982674e1a..2202abe16 100644 --- a/httpclient/src/main/java/org/apache/http/conn/ssl/DefaultHostnameVerifier.java +++ b/httpclient/src/main/java/org/apache/http/conn/ssl/DefaultHostnameVerifier.java @@ -305,8 +305,12 @@ public final class DefaultHostnameVerifier implements HostnameVerifier { for (final List entry : entries) { final Integer type = entry.size() >= 2 ? (Integer) entry.get(0) : null; if (type != null) { - final String s = (String) entry.get(1); - result.add(new SubjectName(s, type)); + final Object o = entry.get(1); + if (o instanceof String) { + result.add(new SubjectName((String) o, type.intValue())); + } else if (o instanceof byte[]) { + // TODO ASN.1 DER encoded form + } } } return result;