[jboss-remoting-commits] JBoss Remoting SVN: r5623 - remoting2/branches/2.x/src/main/org/jboss/remoting/security.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Thu Dec 24 21:07:30 EST 2009


Author: ron.sigal at jboss.com
Date: 2009-12-24 21:07:29 -0500 (Thu, 24 Dec 2009)
New Revision: 5623

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/security/SSLSocketBuilder.java
Log:
JBREM-1172: Can handle keystore / truststore URL set to "NONE".

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/security/SSLSocketBuilder.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/security/SSLSocketBuilder.java	2009-12-24 17:40:34 UTC (rev 5622)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/security/SSLSocketBuilder.java	2009-12-25 02:07:29 UTC (rev 5623)
@@ -234,6 +234,8 @@
     * when not using custom config.
     */
    public static final String REMOTING_DEFAULT_SOCKET_FACTORY_CLASS = "org.jboss.remoting.defaultSocketFactory";
+   
+   public static final String NONE_STORE = "NONE";
 
    private SSLContext sslContextServerSocketFactory = null; // context that builds the server socket factories
    private SSLContext sslContextSocketFactory = null; // context that builds the socket factories
@@ -267,6 +269,19 @@
    private boolean useSSLSocketFactory = true;
 
    private static final Logger log = Logger.getLogger(SSLSocketBuilder.class);
+   
+   private static URL NONE_STORE_URL;
+   
+   static
+   {
+      try
+      {
+         NONE_STORE_URL = new URL("file:NONE");
+      } catch (MalformedURLException e)
+      {
+         log.info("unexpected URL exception", e);
+      }
+   }
 
    /**
     * Constructor for {@link SSLSocketBuilder} that does not have
@@ -1550,13 +1565,18 @@
          throw new NullStoreURLException("Can not find store file for url because store url is null.");
       }
 
+      URL url = storePathURL == NONE_STORE_URL ? null : storePathURL;
+      
       // now that keystore instance created, need to load data from file
       InputStream keyStoreInputStream = null;
 
       try
       {
-         keyStoreInputStream = storePathURL.openStream();
-
+         if (url != null)
+         {
+            keyStoreInputStream = url.openStream();
+         }
+      	
          // is ok for password to be null, as will just be used to check integrity of store
          char[] password = storePassword != null ? storePassword.toCharArray() : null;
          keyStore.load(keyStoreInputStream, password);
@@ -1596,6 +1616,11 @@
     */
    protected URL validateStoreURL(String storePath) throws IOException
    {
+      if (storePath == NONE_STORE)
+      {
+         return NONE_STORE_URL;
+      }
+      
       URL url = null;
 
       // First see if this is a URL



More information about the jboss-remoting-commits mailing list