Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5E814964D for ; Tue, 3 Jul 2012 17:17:19 +0000 (UTC) Received: (qmail 36871 invoked by uid 500); 3 Jul 2012 17:17:19 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 36817 invoked by uid 500); 3 Jul 2012 17:17:19 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 36810 invoked by uid 99); 3 Jul 2012 17:17:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Jul 2012 17:17:19 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Jul 2012 17:17:16 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 74EE023888EA; Tue, 3 Jul 2012 17:16:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1356839 - in /cxf/branches/2.5.x-fixes: ./ rt/transports/http/src/main/java/org/apache/cxf/configuration/jsse/spring/TLSParameterJaxBUtils.java Date: Tue, 03 Jul 2012 17:16:55 -0000 To: commits@cxf.apache.org From: sergeyb@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120703171655.74EE023888EA@eris.apache.org> 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.