cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1356826 - in /cxf/branches/2.6.x-fixes: ./ api/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterJaxBUtils.java
Date Tue, 03 Jul 2012 16:50:10 GMT
Author: sergeyb
Date: Tue Jul  3 16:50:09 2012
New Revision: 1356826

URL: http://svn.apache.org/viewvc?rev=1356826&view=rev
Log:
Merged revisions 1356822 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1356822 | sergeyb | 2012-07-03 17:46:26 +0100 (Tue, 03 Jul 2012) | 1 line
  
  TLSParameterJaxBUtils needs to use ResourceManager to locate the store resources if ClassLoaderUtils
can not locate them
........

Modified:
    cxf/branches/2.6.x-fixes/   (props changed)
    cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterJaxBUtils.java

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1356822

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterJaxBUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterJaxBUtils.java?rev=1356826&r1=1356825&r2=1356826&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterJaxBUtils.java
(original)
+++ cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterJaxBUtils.java
Tue Jul  3 16:50:09 2012
@@ -39,6 +39,8 @@ import javax.net.ssl.KeyManagerFactory;
 import javax.net.ssl.TrustManager;
 import javax.net.ssl.TrustManagerFactory;
 
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.configuration.security.CertStoreType;
@@ -46,6 +48,7 @@ import org.apache.cxf.configuration.secu
 import org.apache.cxf.configuration.security.KeyStoreType;
 import org.apache.cxf.configuration.security.SecureRandomParameters;
 import org.apache.cxf.configuration.security.TrustManagersType;
+import org.apache.cxf.resource.ResourceManager;
 
 /**
  * This class provides some functionality to convert the JAXB
@@ -121,8 +124,7 @@ public final class TLSParameterJaxBUtils
         if (kst.isSetFile()) {
             keyStore.load(new FileInputStream(kst.getFile()), password);
         } else if (kst.isSetResource()) {
-            final java.io.InputStream is =
-                ClassLoaderUtils.getResourceAsStream(kst.getResource(), kst.getClass());
+            final java.io.InputStream is = getResourceAsStream(kst.getResource());
             if (is == null) {
                 final String msg =
                     "Could not load keystore resource " + kst.getResource();
@@ -157,8 +159,7 @@ public final class TLSParameterJaxBUtils
             return createTrustStore(new FileInputStream(pst.getFile()));
         }
         if (pst.isSetResource()) {
-            final java.io.InputStream is =
-                ClassLoaderUtils.getResourceAsStream(pst.getResource(), pst.getClass());
+            final java.io.InputStream is = getResourceAsStream(pst.getResource());
             if (is == null) {
                 final String msg =
                     "Could not load truststore resource " + pst.getResource();
@@ -174,6 +175,18 @@ public final class TLSParameterJaxBUtils
         return null;
     }
 
+    private static InputStream getResourceAsStream(String resource) {
+        InputStream is = ClassLoaderUtils.getResourceAsStream(resource, TLSParameterJaxBUtils.class);
+        if (is == null) {
+            Bus bus = BusFactory.getThreadDefaultBus(true);
+            ResourceManager rm = bus.getExtension(ResourceManager.class);
+            if (rm != null) {
+                is = rm.getResourceAsStream(resource);
+            }
+        }
+        return is;
+    }
+    
     /**
      * Create a KeyStore containing the trusted CA certificates contained
      * in the supplied input stream.



Mime
View raw message