commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r377868 - /jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java
Date Tue, 14 Feb 2006 22:38:08 GMT
Author: rdonkin
Date: Tue Feb 14 14:38:07 2006
New Revision: 377868

URL: http://svn.apache.org/viewcvs?rev=377868&view=rev
Log:
Reverted 375631 (null getParent). After discussions about the relevant javadocs, it was established
that the interpretation which lead to this patch is probably wrong. The original implementation
supplies null to Class.forName which should create the class from the boot loader.

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=377868&r1=377867&r2=377868&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
Tue Feb 14 14:38:07 2006
@@ -937,11 +937,6 @@
         Class logAdapterClass = null;
         ClassLoader currentCL = getBaseClassLoader();
         
-        //
-        // This variable is used to ensure that the system classloader
-        // is tried only once when getParent is null.
-        boolean systemClassloaderTried = false;
-        
         for(;;) {
             // Loop through the classloader hierarchy trying to find
             // a viable classloader.
@@ -1058,66 +1053,7 @@
             }
             
             // try the parent classloader
-            final ClassLoader parentCL = currentCL.getParent();
-            
-            //
-            // getParent may return null to indicate that the parent
-            // is the 'bootstrap classloader'. This term is difficult.
-            // A reasonable way to interpret this is as
-            // the system classloader which is provided as a base
-            // for delegating classloaders.
-            // 
-            // Note that this functionality cannot be easily tested
-            // since it depends upon an optional behaviour of the basic
-            // java libraries. The Sun libraries do not behave in this 
-            // fashion. It may be possible to create a test that
-            // uses a customized boot classpath containing a special 
-            // implementation but this approach
-            // would need to wait until an open source Java implementation
-            // exists. So sadly, this code path is not unit tested.
-            //
-            if (parentCL == null) {
-                if (systemClassloaderTried == true)
-                {
-                    logDiagnostic("Parent classloader is NULL. But System ClassLoader has
already been tried.");
-                    break;
-                }
-                // try system classloader
-                try {
-                    final ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
-                    if (systemClassLoader == null) {
-                        logDiagnostic("System classloader is NULL. Cannot find parent of
classloader " 
-                                        + objectId(currentCL));
-                        break;
-                    } else if (systemClassLoader.equals(currentCL)) {
-                        // the system classloader has already been tried and failed
-                        logDiagnostic("System classloader tried and failed.");
-                        break;
-                    } else {
-                        // the parent is null indicating that the parent is the boot classloader
-                        // so retry with system classloader
-                        currentCL = systemClassLoader;
-                        
-                        //
-                        // avoid infinite loops by trying the system loader only the
-                        // first time a classloader 
-                        systemClassloaderTried = true;
-                        logDiagnostic("Parent classloader is NULL. Trying System ClassLoader.");
-                    }
-                } catch (Throwable t) {
-                    // getSystemClassLoader is allowed to fail in 
-                    // many strange ways: so need to catch everything
-                    // including errors
-                    logDiagnostic("Failed to get system classloader: '" 
-                                        + t.getMessage() 
-                                        + "'. Cannot find parent of classloader " 
-                                        + objectId(currentCL));
-                    break;
-                }
-            } else {
-                currentCL = parentCL;
-            }
-                
+            currentCL = currentCL.getParent();
         }
 
         if ((logAdapter != null) && affectState) {



---------------------------------------------------------------------
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