[jbosscache-commits] JBoss Cache SVN: r5263 - core/trunk/src/main/java/org/jboss/cache/factories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Wed Jan 30 11:21:33 EST 2008


Author: manik.surtani at jboss.com
Date: 2008-01-30 11:21:33 -0500 (Wed, 30 Jan 2008)
New Revision: 5263

Modified:
   core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
Log:
Added a null check

Modified: core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java	2008-01-30 16:21:16 UTC (rev 5262)
+++ core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java	2008-01-30 16:21:33 UTC (rev 5263)
@@ -753,37 +753,42 @@
             deepRecursionDetector = true;
             for (Component d : dependentComponents)
             {
-               if (d.instance == null)
+               if (d != null)
                {
-                  // this is a "hollow" component that has not been constructed yet.  Another "constructed" version probably exists in the
-                  // componentLookup.  Make sure we replace this.
-                  Component c = componentLookup.get(d.name);
-                  if (increase)
+                  if (d.instance == null)
                   {
-                     dependencies.remove(d);
-                     dependencies.add(c);
+                     // this is a "hollow" component that has not been constructed yet.  Another "constructed" version probably exists in the
+                     // componentLookup.  Make sure we replace this.
+                     Component c = componentLookup.get(d.name);
+                     if (increase)
+                     {
+                        dependencies.remove(d);
+                        dependencies.add(c);
+                     }
+                     else
+                     {
+                        dependencyFor.remove(d);
+                        dependencies.add(c);
+                     }
+                     d = c;
                   }
-                  else
-                  {
-                     dependencyFor.remove(d);
-                     dependencies.add(c);
-                  }
-                  d = c;
-               }
 
-               if (isShallowCyclic(d))
-               {
-                  // don't process shallow cyclic deps here - shoud do that after we set our state.
-                  shallowCyclic.add(d);
-               }
-               else
-               {
-                  // of we are "moving up" - only do this if the component is lower than what is needed.
-                  if ((increase && newState.isGreaterThan(d.state)) || (!increase && newState.isLessThan(d.state)))
+                  if (d != null)
                   {
-                     d.changeState(newState);
+                     if (isShallowCyclic(d))
+                     {
+                        // don't process shallow cyclic deps here - shoud do that after we set our state.
+                        shallowCyclic.add(d);
+                     }
+                     else
+                     {
+                        // of we are "moving up" - only do this if the component is lower than what is needed.
+                        if ((increase && newState.isGreaterThan(d.state)) || (!increase && newState.isLessThan(d.state)))
+                        {
+                           d.changeState(newState);
+                        }
+                     }
                   }
-
                }
             }
 
@@ -826,7 +831,7 @@
        */
       private boolean isShallowCyclic(Component c)
       {
-         return (dependencies.contains(c) && c.dependencies.contains(this));
+         return dependencies.contains(c) && c.dependencies.contains(this);
       }
 
       /**




More information about the jbosscache-commits mailing list