juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tcunn...@apache.org
Subject svn commit: r900879 - in /webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi: ClassUtil.java v3/auth/AuthenticatorFactory.java
Date Tue, 19 Jan 2010 18:17:22 GMT
Author: tcunning
Date: Tue Jan 19 18:17:21 2010
New Revision: 900879

URL: http://svn.apache.org/viewvc?rev=900879&view=rev
Log:
JUDDI-326
Make sure we're using classForName from ClassUtil rather than using the log4j classloading
util.

Added:
    webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/ClassUtil.java
Modified:
    webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/v3/auth/AuthenticatorFactory.java

Added: webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/ClassUtil.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/ClassUtil.java?rev=900879&view=auto
==============================================================================
--- webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/ClassUtil.java (added)
+++ webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/ClassUtil.java Tue Jan
19 18:17:21 2010
@@ -0,0 +1,31 @@
+package org.apache.juddi;
+
+public class ClassUtil {
+    public static Class forName(String name, Class caller)
+    	throws ClassNotFoundException
+    {
+	    ClassLoader threadClassLoader = Thread.currentThread().getContextClassLoader();
+	    if (threadClassLoader != null) {
+	        try {
+	            return Class.forName(name, true, threadClassLoader) ;
+	        } catch (ClassNotFoundException cnfe) {
+	        	if (cnfe.getException() != null) {
+	        		throw cnfe;
+	        	}
+	        }
+	    }
+    
+	    ClassLoader callerClassLoader = caller.getClassLoader();
+	    if (callerClassLoader != null) {
+	        try {
+	            return Class.forName(name, true, callerClassLoader) ;
+	        } catch (final ClassNotFoundException cnfe) {
+	            if (cnfe.getException() != null) {
+	                throw cnfe ;
+	            }
+	        }
+	    }
+	    
+	    return Class.forName(name, true, ClassLoader.getSystemClassLoader()) ;
+    }
+}

Modified: webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/v3/auth/AuthenticatorFactory.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/v3/auth/AuthenticatorFactory.java?rev=900879&r1=900878&r2=900879&view=diff
==============================================================================
--- webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/v3/auth/AuthenticatorFactory.java
(original)
+++ webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/v3/auth/AuthenticatorFactory.java
Tue Jan 19 18:17:21 2010
@@ -18,10 +18,12 @@
 package org.apache.juddi.v3.auth;
 
 import org.apache.commons.configuration.ConfigurationException;
+import org.apache.juddi.ClassUtil;
 import org.apache.juddi.config.AppConfig;
 import org.apache.juddi.config.Property;
 import org.apache.log4j.Logger;
 
+
 /**
  * @author Steve Viens (sviens@apache.org)
  * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
@@ -71,7 +73,7 @@
 		Class<?> authClass = null;
 		try {
 			// Use Loader to locate & load the Authenticator implementation
-			authClass = org.apache.log4j.helpers.Loader.loadClass(className);
+			authClass = ClassUtil.forName(className, AuthenticatorFactory.class);
 		}
 		catch(ClassNotFoundException e) {
 			log.error("The specified Authenticator class '" + className + "' was not found in classpath.");



---------------------------------------------------------------------
To unsubscribe, e-mail: juddi-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: juddi-cvs-help@ws.apache.org


Mime
View raw message