myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arobinso...@apache.org
Subject svn commit: r1445017 - /myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
Date Tue, 12 Feb 2013 02:09:23 GMT
Author: arobinson74
Date: Tue Feb 12 02:09:23 2013
New Revision: 1445017

URL: http://svn.apache.org/r1445017
Log:
Simplify the code that checks if the UIXCollection is in context. This is due to the fact
that the code it was using before was producing false positives under some use cases.

Modified:
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java?rev=1445017&r1=1445016&r2=1445017&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
(original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
Tue Feb 12 02:09:23 2013
@@ -2089,7 +2089,7 @@ public abstract class UIXCollection exte
     // requestMap:
     return setupELVariable(getFacesContext(), varName, newData);
   }
-  
+
   /**
    * Called by UIXCollection to set values for the "var" and
    * "varStatus" EL variables.
@@ -2131,6 +2131,8 @@ public abstract class UIXCollection exte
       RequestContext.getCurrentInstance().getComponentContextManager();
 
     compCtxMgr.pushChange(new CollectionComponentChange(this));
+
+    _inContext = true;
   }
 
   private void _tearDownContextChange()
@@ -2163,6 +2165,10 @@ public abstract class UIXCollection exte
     {
       _LOG.severe(re);
     }
+    finally
+    {
+      _inContext = false;
+    }
   }
 
   private void _verifyComponentInContext()
@@ -2172,17 +2178,12 @@ public abstract class UIXCollection exte
       return;
     }
 
-    ComponentContextManager compCtxMgr =
-      RequestContext.getCurrentInstance().getComponentContextManager();
-    ComponentContextChange change = compCtxMgr.peekChange();
-
-    if (!(change instanceof CollectionComponentChange) ||
-        ((CollectionComponentChange)change)._component != this)
+    if (!_inContext)
     {
       if (_LOG.isWarning())
       {
-        _LOG.warning("COLLECTION_NOT_IN_CONTEXT", (Object)(getParent() == null ? 
-          getId() : getClientId()));
+        _LOG.warning("COLLECTION_NOT_IN_CONTEXT",
+          new Object[] { getParent() == null ? getId() : getClientId() });
         if (_LOG.isFine())
         {
           Thread.currentThread().dumpStack();
@@ -2420,6 +2421,8 @@ public abstract class UIXCollection exte
             _component.setRowKey(null);
           }
         }
+
+        _component._inContext = false;
       }
       finally
       {
@@ -2438,6 +2441,8 @@ public abstract class UIXCollection exte
         {
           _component.setRowKey(_rowKey);
         }
+
+        _component._inContext = true;
       }
       finally
       {
@@ -2484,6 +2489,7 @@ public abstract class UIXCollection exte
   // end up sharing this stampState. see bug 4279735:
   private InternalState _state = null;
   private boolean _inSuspendOrResume = false;
+  private boolean _inContext = false;
 
   // use this key to indicate uninitialized state.
   // all the variables that use this are transient so this object need not



Mime
View raw message