You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wss4j-dev@ws.apache.org by di...@apache.org on 2006/08/15 19:42:20 UTC
svn commit: r431652 - in /webservices/wss4j/trunk/src/org/apache/ws/security:
components/crypto/AbstractCrypto.java util/Loader.java
Author: dims
Date: Tue Aug 15 10:42:20 2006
New Revision: 431652
URL: http://svn.apache.org/viewvc?rev=431652&view=rev
Log:
Use TCCL's getResource if Discovery jar is missing
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/components/crypto/AbstractCrypto.java
webservices/wss4j/trunk/src/org/apache/ws/security/util/Loader.java
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/components/crypto/AbstractCrypto.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/components/crypto/AbstractCrypto.java?rev=431652&r1=431651&r2=431652&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/components/crypto/AbstractCrypto.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/components/crypto/AbstractCrypto.java Tue Aug 15 10:42:20 2006
@@ -23,6 +23,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ws.security.WSSecurityException;
+import org.apache.ws.security.util.Loader;
import java.io.FileInputStream;
import java.io.IOException;
@@ -91,16 +92,25 @@
String location = this.properties.getProperty("org.apache.ws.security.crypto.merlin.file");
InputStream is = null;
- /**
- * Look for the keystore in classpaths
- */
- DiscoverResources disc = new DiscoverResources();
- disc.addClassLoader(JDKHooks.getJDKHooks().getThreadContextClassLoader());
- disc.addClassLoader(loader);
- ResourceIterator iterator = disc.findResources(location);
- if (iterator.hasNext()) {
- Resource resource = iterator.nextResource();
- is = resource.getResourceAsStream();
+ try {
+ /**
+ * Look for the keystore in classpaths using commons discovery
+ */
+ DiscoverResources disc = new DiscoverResources();
+ disc.addClassLoader(JDKHooks.getJDKHooks().getThreadContextClassLoader());
+ disc.addClassLoader(loader);
+ ResourceIterator iterator = disc.findResources(location);
+ if (iterator.hasNext()) {
+ Resource resource = iterator.nextResource();
+ is = resource.getResourceAsStream();
+ }
+ } catch (java.lang.NoClassDefFoundError ex) {
+ /**
+ * Look for the keystore in classpaths using TCCL
+ */
+ if (is == null) {
+ is = Loader.getResource(loader, location).openStream();
+ }
}
/**
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/util/Loader.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/util/Loader.java?rev=431652&r1=431651&r2=431652&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/util/Loader.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/util/Loader.java Tue Aug 15 10:42:20 2006
@@ -86,7 +86,7 @@
* @return Class
* @throws ClassNotFoundException
*/
- static public URL getResource(ClassLoader loader, String resource) throws ClassNotFoundException {
+ static public URL getResource(ClassLoader loader, String resource) {
URL url = null;
try {
if (loader != null) {
---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org