Only try to use OpenSslX509TrustManagerWrapper when using Java 7+ (#9065)
Motivation: We should only try to use OpenSslX509TrustManagerWrapper when using Java 7+ as otherwise it fail to init in it's static block as X509ExtendedTrustManager was only introduced in Java7 Modifications: Only call OpenSslX509TrustManagerWrapper if we use Java7+ Result: Fixes https://github.com/netty/netty/issues/9064.
This commit is contained in:
parent
1d9090aab2
commit
3ebd29f9c7
@ -576,7 +576,10 @@ public abstract class ReferenceCountedOpenSslContext extends SslContext implemen
|
|||||||
protected static X509TrustManager chooseTrustManager(TrustManager[] managers) {
|
protected static X509TrustManager chooseTrustManager(TrustManager[] managers) {
|
||||||
for (TrustManager m : managers) {
|
for (TrustManager m : managers) {
|
||||||
if (m instanceof X509TrustManager) {
|
if (m instanceof X509TrustManager) {
|
||||||
return OpenSslX509TrustManagerWrapper.wrapIfNeeded((X509TrustManager) m);
|
if (PlatformDependent.javaVersion() >= 7) {
|
||||||
|
return OpenSslX509TrustManagerWrapper.wrapIfNeeded((X509TrustManager) m);
|
||||||
|
}
|
||||||
|
return (X509TrustManager) m;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new IllegalStateException("no X509TrustManager found");
|
throw new IllegalStateException("no X509TrustManager found");
|
||||||
|
Loading…
Reference in New Issue
Block a user