You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2012/07/03 19:16:55 UTC
svn commit: r1356839 - in /cxf/branches/2.5.x-fixes: ./
rt/transports/http/src/main/java/org/apache/cxf/configuration/jsse/spring/TLSParameterJaxBUtils.java
Author: sergeyb
Date: Tue Jul 3 17:16:53 2012
New Revision: 1356839
URL: http://svn.apache.org/viewvc?rev=1356839&view=rev
Log:
Merged revisions 1356826 via svnmerge from
https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes
................
r1356826 | sergeyb | 2012-07-03 17:50:09 +0100 (Tue, 03 Jul 2012) | 9 lines
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.5.x-fixes/ (props changed)
cxf/branches/2.5.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/configuration/jsse/spring/TLSParameterJaxBUtils.java
Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
Merged /cxf/trunk:r1356822
Merged /cxf/branches/2.6.x-fixes:r1356826
Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.5.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/configuration/jsse/spring/TLSParameterJaxBUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/configuration/jsse/spring/TLSParameterJaxBUtils.java?rev=1356839&r1=1356838&r2=1356839&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/configuration/jsse/spring/TLSParameterJaxBUtils.java (original)
+++ cxf/branches/2.5.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/configuration/jsse/spring/TLSParameterJaxBUtils.java Tue Jul 3 17:16:53 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;
import org.apache.cxf.transport.https.SSLUtils;
/**
@@ -122,8 +125,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();
@@ -158,8 +160,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();
@@ -175,6 +176,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.