commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1089209 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java
Date Tue, 05 Apr 2011 20:35:40 GMT
Author: simonetripodi
Date: Tue Apr  5 20:35:40 2011
New Revision: 1089209

URL: http://svn.apache.org/viewvc?rev=1089209&view=rev
Log:
minor code format

Modified:
    commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java

Modified: commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java
URL: http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java?rev=1089209&r1=1089208&r2=1089209&view=diff
==============================================================================
--- commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java
(original)
+++ commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java
Tue Apr  5 20:35:40 2011
@@ -21,15 +21,14 @@ import java.util.List;
 
 import org.apache.commons.discovery.jdk.JDKHooks;
 
-
 /**
  * There are many different contexts in which
  * loaders can be used.  This provides a holder
  * for a set of class loaders, so that they
  * don't have to be build back up everytime...
  */
-public class ClassLoaders
-{
+public class ClassLoaders {
+
     protected List<ClassLoader> classLoaders = new LinkedList<ClassLoader>();
 
     /**
@@ -72,7 +71,6 @@ public class ClassLoaders
         }
     }
 
-
     /**
      * Specify a new class loader to be used in searching.
      * The order of loaders determines the order of the result.
@@ -90,7 +88,6 @@ public class ClassLoaders
         }
     }
 
-
     /**
      * Check to see if <code>classLoader</code> is an
      * ancestor of any contained class loader.
@@ -108,14 +105,14 @@ public class ClassLoaders
      */
     public boolean isAncestor(final ClassLoader classLoader) {
         /* bootstrap classloader, at root of all trees! */
-        if (classLoader == null)
+        if (classLoader == null) {
             return true;
+        }
 
         for (int idx = 0; idx < size(); idx++) {
-            for(ClassLoader walker = get(idx);
-                walker != null;
-                walker = walker.getParent())
-            {
+            for (ClassLoader walker = get(idx);
+                    walker != null;
+                    walker = walker.getParent()) {
                 if (walker == classLoader) {
                     return true;
                 }
@@ -124,7 +121,6 @@ public class ClassLoaders
         return false;
     }
 
-
     /**
      * Utility method.  Returns a preloaded ClassLoaders instance
      * containing the following class loaders, in order:
@@ -147,8 +143,12 @@ public class ClassLoaders
     public static ClassLoaders getLibLoaders(Class<?> spi, Class<?> factory,
boolean prune) {
         ClassLoaders loaders = new ClassLoaders();
 
-        if (spi != null) loaders.put(spi.getClassLoader());
-        if (factory != null) loaders.put(factory.getClassLoader(), prune);
+        if (spi != null) {
+            loaders.put(spi.getClassLoader());
+        }
+        if (factory != null) {
+            loaders.put(factory.getClassLoader(), prune);
+        }
         loaders.put(JDKHooks.getJDKHooks().getSystemClassLoader(), prune);
 
         return loaders;
@@ -178,10 +178,15 @@ public class ClassLoaders
         ClassLoaders loaders = new ClassLoaders();
 
         loaders.put(JDKHooks.getJDKHooks().getThreadContextClassLoader());
-        if (spi != null) loaders.put(spi.getClassLoader(), prune);
-        if (factory != null) loaders.put(factory.getClassLoader(), prune);
+        if (spi != null) {
+            loaders.put(spi.getClassLoader(), prune);
+        }
+        if (factory != null) {
+            loaders.put(factory.getClassLoader(), prune);
+        }
         loaders.put(JDKHooks.getJDKHooks().getSystemClassLoader(), prune);
 
         return loaders;
     }
+
 }



Mime
View raw message