You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2012/01/16 19:34:33 UTC

svn commit: r1232106 - /myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/behavior/BehaviorBase.java

Author: lu4242
Date: Mon Jan 16 18:34:32 2012
New Revision: 1232106

URL: http://svn.apache.org/viewvc?rev=1232106&view=rev
Log:
MYFACES-3425 [perf] enhance code applying best practices

Modified:
    myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/behavior/BehaviorBase.java

Modified: myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/behavior/BehaviorBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/behavior/BehaviorBase.java?rev=1232106&r1=1232105&r2=1232106&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/behavior/BehaviorBase.java (original)
+++ myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/behavior/BehaviorBase.java Mon Jan 16 18:34:32 2012
@@ -66,8 +66,9 @@ public class BehaviorBase implements Beh
             // This code prevent listeners from unregistering themselves while processing the event.
             // I believe it should always be alright in this case. However, the need rise, then it 
             // should be possible to remove that limitation by using a clone for the looping
-            for (BehaviorListener listener : _behaviorListeners)
+            for (int i = 0; i < _behaviorListeners.size() ; i++)
             {
+                BehaviorListener listener = _behaviorListeners.get(i);
                 if (event.isAppropriateListener(listener))
                 {
                     event.processListener(listener);
@@ -161,7 +162,9 @@ public class BehaviorBase implements Beh
         }
         
         if (attachedObject == null)
+        {
             return null;
+        }
         // StateHolder interface should take precedence over
         // List children
         if (attachedObject instanceof StateHolder)
@@ -200,9 +203,13 @@ public class BehaviorBase implements Beh
     private static Object restoreAttachedState(FacesContext context, Object stateObj) throws IllegalStateException
     {
         if (context == null)
+        {
             throw new NullPointerException("context");
+        }
         if (stateObj == null)
+        {
             return null;
+        }
         if (stateObj instanceof _AttachedListStateWrapper)
         {
             List<Object> lst = ((_AttachedListStateWrapper) stateObj).getWrappedStateList();