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

Contributed by Gary Gregory <ggregory at apache.org>, Ilian Iliev <ilian_iliev at yahoo.com>
This commit is contained in:
Gary D. Gregory 2017-03-28 18:50:01 +00:00 committed by Oleg Kalnichevski
parent 54a2fb2662
commit c58288c9af
2 changed files with 8 additions and 2 deletions

View File

@ -17,6 +17,8 @@ Changelog:
* [HTTPCLIENT-1816] Update Apache Commons Codec 1.9 to 1.10.
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 4.5.3
-------------------

View File

@ -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;