You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sm...@apache.org on 2020/03/15 14:38:15 UTC

[directory-fortress-core] branch master updated: FC-278 - RestUtils throws NPE when trust.store property null

This is an automated email from the ASF dual-hosted git repository.

smckinney pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-fortress-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 8554cf6  FC-278 - RestUtils throws NPE when trust.store property null
8554cf6 is described below

commit 8554cf614d2a64aa39d394b85ee7965e5969527c
Author: Shawn McKinney <sm...@symas.com>
AuthorDate: Sun Mar 15 09:38:08 2020 -0500

    FC-278 - RestUtils throws NPE when trust.store property null
---
 .../org/apache/directory/fortress/core/rest/RestUtils.java     | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/directory/fortress/core/rest/RestUtils.java b/src/main/java/org/apache/directory/fortress/core/rest/RestUtils.java
index 5890078..9906bdd 100644
--- a/src/main/java/org/apache/directory/fortress/core/rest/RestUtils.java
+++ b/src/main/java/org/apache/directory/fortress/core/rest/RestUtils.java
@@ -136,10 +136,12 @@ public final class RestUtils
         serviceName = "fortress-rest-" + fortressRestVersion;
         uri = httpProtocol + "://" + httpHost + ":" + httpPort + "/" + serviceName + "/";
         LOG.info("HTTP Connect Properties: host:{}, port:{}, protocol:{}, version:{}, service:{}, uri:{}", httpHost, httpPort, httpProtocol, fortressRestVersion, serviceName, uri);
-        LOG.info( "Set JSSE truststore properties:" );
-        LOG.info( "javax.net.ssl.trustStore: {}", trustStore );
-        System.setProperty( "javax.net.ssl.trustStore", trustStore );
-        System.setProperty( "javax.net.ssl.trustStorePassword", trustStorePw );
+        if( StringUtils.isNotEmpty(trustStore ) && StringUtils.isNotEmpty(trustStorePw ) )
+        {
+            LOG.info( "javax.net.ssl.trustStore: {}", trustStore );
+            System.setProperty( "javax.net.ssl.trustStore", trustStore );
+            System.setProperty( "javax.net.ssl.trustStorePassword", trustStorePw );
+        }
         //System.setProperty( "http.maxConnections", "50" );
     }