From f1bf47eaef0145fd0fafdf51067203352e85c9e2 Mon Sep 17 00:00:00 2001 From: baranowb Date: Wed, 27 Oct 2021 10:17:41 +0200 Subject: [PATCH] [WFSSL-83] add warn log when no SSL lib is found. --- java/src/main/java/org/wildfly/openssl/SSL.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/java/src/main/java/org/wildfly/openssl/SSL.java b/java/src/main/java/org/wildfly/openssl/SSL.java index a8cd0c96..3a604770 100644 --- a/java/src/main/java/org/wildfly/openssl/SSL.java +++ b/java/src/main/java/org/wildfly/openssl/SSL.java @@ -29,6 +29,7 @@ import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.logging.Level; import java.util.logging.Logger; /** @@ -186,10 +187,18 @@ static void init() { } } if (sslPath == null) { - throw new RuntimeException(Messages.MESSAGES.couldNotFindLibSSL(ORG_WILDFLY_OPENSSL_PATH, attemptedSSL.toString())); + final String warningMessage = Messages.MESSAGES.couldNotFindLibSSL(ORG_WILDFLY_OPENSSL_PATH, attemptedSSL.toString()); + if(logger.isLoggable(Level.WARNING)) { + logger.warning(warningMessage); + } + throw new RuntimeException(warningMessage); } if (cryptoPath == null) { - throw new RuntimeException(Messages.MESSAGES.couldNotFindLibCrypto(ORG_WILDFLY_OPENSSL_PATH, attemptedCrypto.toString())); + final String warningMessage = Messages.MESSAGES.couldNotFindLibCrypto(ORG_WILDFLY_OPENSSL_PATH, attemptedCrypto.toString()); + if(logger.isLoggable(Level.WARNING)) { + logger.warning(warningMessage); + } + throw new RuntimeException(warningMessage); } instance.initialize(cryptoPath, sslPath); String version = instance.version();