Fix NPE in OpenSslEngine
Motivation: The gRPC interop tests fail due to a NPE in OpenSslEngine. Caused by: java.lang.NullPointerException at io.netty.handler.ssl.OpenSslEngine.setSSLParameters(OpenSslEngine.java:1473) Modifications: Add a null check Result: No more NPE exceptions :-)
This commit is contained in:
parent
57672d9854
commit
f3dc483c99
@ -1470,12 +1470,15 @@ public final class OpenSslEngine extends SSLEngine {
|
||||
assert GET_ASCII_NAME_METHOD != null;
|
||||
try {
|
||||
List<?> servernames = (List<?>) GET_SERVER_NAMES_METHOD.invoke(sslParameters);
|
||||
for (Object serverName : servernames) {
|
||||
if (SNI_HOSTNAME_CLASS.isInstance(serverName)) {
|
||||
SSL.setTlsExtHostName(ssl, (String) GET_ASCII_NAME_METHOD.invoke(serverName));
|
||||
} else {
|
||||
throw new IllegalArgumentException("Only " + SNI_HOSTNAME_CLASS.getName()
|
||||
+ " instances are supported, but found: " + serverName);
|
||||
if (servernames != null) {
|
||||
for (Object serverName : servernames) {
|
||||
if (SNI_HOSTNAME_CLASS.isInstance(serverName)) {
|
||||
SSL.setTlsExtHostName(ssl, (String) GET_ASCII_NAME_METHOD.invoke(serverName));
|
||||
} else {
|
||||
throw new IllegalArgumentException("Only " + SNI_HOSTNAME_CLASS.getName()
|
||||
+ " instances are supported, but found: " +
|
||||
serverName);
|
||||
}
|
||||
}
|
||||
}
|
||||
sniHostNames = servernames;
|
||||
|
Loading…
Reference in New Issue
Block a user