[HTTPCLIENT-1836] DefaultHostnameVerifier#getSubjectAltNames(X509Certificate) throws java.lang.ClassCastException.

Contributed by Gary Gregory <ggregory at apache.org>, Ilian Iliev <ilian_iliev at yahoo.com>


git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1789189 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary D. Gregory 2017-03-28 18:53:43 +00:00
parent ab46a44871
commit e1c5e5922a
2 changed files with 12 additions and 2 deletions

View File

@ -19,6 +19,12 @@ Changelog:
* [HTTPCLIENT-1817] Add a "Trust All" TrustStrategy implementation.
Contributed by Gary Gregory <ggregory at apache.org>
* [HTTPCLIENT-1817] Add a "Trust All" TrustStrategy implementation.
Contributed by Gary Gregory <ggregory at apache.org>
* [HTTPCLIENT-1836] DefaultHostnameVerifier#getSubjectAltNames(X509Certificate) throws java.lang.ClassCastException.
Contributed by Gary Gregory <ggregory at apache.org>, Ilian Iliev <ilian_iliev at yahoo.com>
Release 5.0-ALPHA1
-------------------

View File

@ -303,8 +303,12 @@ public final class DefaultHostnameVerifier implements HttpClientHostnameVerifier
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;