[ 
https://issues.apache.org/jira/browse/ARTEMIS-445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15204497#comment-15204497
 ] 

Dominique Toupin commented on ARTEMIS-445:
------------------------------------------

I am not sure on the how/where to contribute a pull request, but here are the 
changes that looks sufficient to fix this issue:

{code:title=artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java|borderStyle=solid}
diff --git 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java
 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java
index 3593294..7871ef9 100644
--- 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java
+++ 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java
@@ -103,7 +103,7 @@ public class SSLSupport {
             URL keystoreURL = SSLSupport.validateStoreURL(keystorePath);
             in = keystoreURL.openStream();
          }
-         ks.load(in, keystorePassword.toCharArray());
+         ks.load(in, keystorePassword == null ? null : 
keystorePassword.toCharArray());
       }
       finally {
          if (in != null) {
@@ -126,7 +126,7 @@ public class SSLSupport {
       else {
          KeyManagerFactory kmf = 
KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
          KeyStore ks = SSLSupport.loadKeystore(keyStoreProvider, keystorePath, 
keystorePassword);
-         kmf.init(ks, keystorePassword.toCharArray());
+         kmf.init(ks, keystorePassword == null ? null : 
keystorePassword.toCharArray());
 
          return kmf.getKeyManagers();
       }
{code}

> Truststore/Keystore password cannot be null although null is an acceptable 
> value
> --------------------------------------------------------------------------------
>
>                 Key: ARTEMIS-445
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-445
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>    Affects Versions: 1.0.0, 1.1.0, 1.2.0
>         Environment: Wildfly 10.0.0.Final
>            Reporter: Dominique Toupin
>            Assignee: Justin Bertram
>            Priority: Minor
>              Labels: newbie
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> It is currently impossible to define a connector with SSL enabled to which 
> the only other piece of information provided is the truststore path. The 
> reason for this is that although the truststore password could be null by 
> definition (java.security.KeyStore.load accept a null value), the code does 
> not check whether the variable keystorePassword is not null before calling 
> toCharArray and therefore we end up with a NullPointerException



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to