commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From skitch...@apache.org
Subject svn commit: r179571 - /jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java
Date Thu, 02 Jun 2005 10:28:37 GMT
Author: skitching
Date: Thu Jun  2 03:28:35 2005
New Revision: 179571

URL: http://svn.apache.org/viewcvs?rev=179571&view=rev
Log:
Remove ugly LOG_INTERFACE string and weird log-class-lookup code
from within the reportInvalidLogAdapter method.

Modified:
    jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java

Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java?rev=179571&r1=179570&r2=179571&view=diff
==============================================================================
--- jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java
(original)
+++ jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java
Thu Jun  2 03:28:35 2005
@@ -100,13 +100,6 @@
         "org.apache.commons.logging.log";
 
 
-    /**
-     * <p>The name of the {@link Log} interface class.</p>
-     */
-    private static final String LOG_INTERFACE =
-        "org.apache.commons.logging.Log";
-
-
     // ----------------------------------------------------- Instance Variables
 
 
@@ -858,27 +851,17 @@
     private LogConfigurationException reportInvalidLogAdapter(Class logClass,
                                                               Throwable cause) {
         
+        String logInterfaceName = Log.class.getName();
         Class interfaces[] = logClass.getInterfaces();
         for (int i = 0; i < interfaces.length; i++) {
-            if (LOG_INTERFACE.equals(interfaces[i].getName())) {
+            if (logInterfaceName.equals(interfaces[i].getName())) {
 
                 if (isDiagnosticsEnabled()) {                    
                     
                     try {
                         // Need to load the log interface so we know its
                         // classloader for diagnostics
-                        Class logInterface = null;
-                        ClassLoader cl = getClassLoader(this.getClass());
-                        if (cl == null) {
-                            // we are probably in Java 1.1, but may also be 
-                            // running in some sort of embedded system..
-                            logInterface = loadClass(LOG_INTERFACE);
-                        } else {
-                            // normal situation
-                            logInterface = cl.loadClass(LOG_INTERFACE);
-                        }
-
-                        ClassLoader logInterfaceClassLoader = getClassLoader(logInterface);
+                        ClassLoader logInterfaceClassLoader = getClassLoader(Log.class);
                         ClassLoader logAdapterClassLoader = getClassLoader(logClass);
                         Class logAdapterInterface = interfaces[i];
                         ClassLoader logAdapterInterfaceClassLoader = getClassLoader(logAdapterInterface);
@@ -899,14 +882,14 @@
                 return new LogConfigurationException
                     ("Invalid class loader hierarchy.  " +
                      "You have more than one version of '" +
-                     LOG_INTERFACE + "' visible, which is " +
+                     logInterfaceName + "' visible, which is " +
                      "not allowed.", cause);
             }
         }
             
         return new LogConfigurationException
-            ("Class " + logClassName + " does not implement '" +
-                    LOG_INTERFACE + "'.", cause);
+            ("Class " + logClass.getName() + " does not implement '" +
+                    logInterfaceName + "'.", cause);
     }
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message