ARTEMIS-3433 - allow null return and throw error only startup usage paths
This commit is contained in:
parent
6bd76386f1
commit
925ceadffa
|
@ -115,6 +115,7 @@ import org.apache.activemq.artemis.spi.core.remoting.BufferHandler;
|
|||
import org.apache.activemq.artemis.spi.core.remoting.ClientConnectionLifeCycleListener;
|
||||
import org.apache.activemq.artemis.spi.core.remoting.ClientProtocolManager;
|
||||
import org.apache.activemq.artemis.spi.core.remoting.Connection;
|
||||
import org.apache.activemq.artemis.spi.core.remoting.ssl.OpenSSLContextFactory;
|
||||
import org.apache.activemq.artemis.spi.core.remoting.ssl.OpenSSLContextFactoryProvider;
|
||||
import org.apache.activemq.artemis.spi.core.remoting.ssl.SSLContextConfig;
|
||||
import org.apache.activemq.artemis.spi.core.remoting.ssl.SSLContextFactoryProvider;
|
||||
|
@ -760,8 +761,11 @@ public class NettyConnector extends AbstractConnector {
|
|||
}
|
||||
|
||||
private SSLEngine loadOpenSslEngine(final ByteBufAllocator alloc, final SSLContextConfig sslContextConfig) throws Exception {
|
||||
final SslContext context = OpenSSLContextFactoryProvider.getOpenSSLContextFactory()
|
||||
.getClientSslContext(sslContextConfig, configuration);
|
||||
final OpenSSLContextFactory factory = OpenSSLContextFactoryProvider.getOpenSSLContextFactory();
|
||||
if (factory == null) {
|
||||
throw new IllegalStateException("No OpenSSLContextFactory registered!");
|
||||
}
|
||||
final SslContext context = factory.getClientSslContext(sslContextConfig, configuration);
|
||||
|
||||
if (host != null && port != -1) {
|
||||
return context.newEngine(alloc, host, port);
|
||||
|
|
|
@ -31,9 +31,6 @@ public class OpenSSLContextFactoryProvider {
|
|||
}
|
||||
}
|
||||
|
||||
if (factoryWithHighestPrio == null)
|
||||
throw new IllegalStateException("No OpenSSLContextFactory registered!");
|
||||
|
||||
FACTORY = factoryWithHighestPrio;
|
||||
}
|
||||
|
||||
|
|
|
@ -89,6 +89,7 @@ import org.apache.activemq.artemis.spi.core.protocol.ProtocolManager;
|
|||
import org.apache.activemq.artemis.spi.core.remoting.BufferHandler;
|
||||
import org.apache.activemq.artemis.spi.core.remoting.Connection;
|
||||
import org.apache.activemq.artemis.spi.core.remoting.ServerConnectionLifeCycleListener;
|
||||
import org.apache.activemq.artemis.spi.core.remoting.ssl.OpenSSLContextFactory;
|
||||
import org.apache.activemq.artemis.spi.core.remoting.ssl.OpenSSLContextFactoryProvider;
|
||||
import org.apache.activemq.artemis.spi.core.remoting.ssl.SSLContextConfig;
|
||||
import org.apache.activemq.artemis.spi.core.remoting.ssl.SSLContextFactoryProvider;
|
||||
|
@ -381,7 +382,11 @@ public class NettyAcceptor extends AbstractAcceptor {
|
|||
checkSSLConfiguration();
|
||||
try {
|
||||
if (TransportConstants.OPENSSL_PROVIDER.equals(sslProvider)) {
|
||||
return OpenSSLContextFactoryProvider.getOpenSSLContextFactory().getServerSslContext(sslContextConfig, configuration);
|
||||
OpenSSLContextFactory factory = OpenSSLContextFactoryProvider.getOpenSSLContextFactory();
|
||||
if (factory != null) {
|
||||
return factory.getServerSslContext(sslContextConfig, configuration);
|
||||
}
|
||||
throw new IllegalStateException("No OpenSSLContextFactory registered!");
|
||||
} else {
|
||||
return SSLContextFactoryProvider.getSSLContextFactory().getSSLContext(sslContextConfig, configuration);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue