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 C6B0A9552 for ; Tue, 3 Jul 2012 16:46:48 +0000 (UTC) Received: (qmail 55736 invoked by uid 500); 3 Jul 2012 16:46:48 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 55662 invoked by uid 500); 3 Jul 2012 16:46:48 -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 55655 invoked by uid 99); 3 Jul 2012 16:46:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Jul 2012 16:46:48 +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 16:46:47 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 2133E23889BB; Tue, 3 Jul 2012 16:46:27 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1356822 - /cxf/trunk/api/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterJaxBUtils.java Date: Tue, 03 Jul 2012 16:46:26 -0000 To: commits@cxf.apache.org From: sergeyb@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120703164627.2133E23889BB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sergeyb Date: Tue Jul 3 16:46:26 2012 New Revision: 1356822 URL: http://svn.apache.org/viewvc?rev=1356822&view=rev Log: TLSParameterJaxBUtils needs to use ResourceManager to locate the store resources if ClassLoaderUtils can not locate them Modified: cxf/trunk/api/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterJaxBUtils.java Modified: cxf/trunk/api/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterJaxBUtils.java URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterJaxBUtils.java?rev=1356822&r1=1356821&r2=1356822&view=diff ============================================================================== --- cxf/trunk/api/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterJaxBUtils.java (original) +++ cxf/trunk/api/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterJaxBUtils.java Tue Jul 3 16:46:26 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.