You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gc...@apache.org on 2011/03/16 01:29:20 UTC

svn commit: r1082011 - /myfaces/trinidad/trunk/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXEditableValueTemplate.java

Author: gcrawford
Date: Wed Mar 16 00:29:20 2011
New Revision: 1082011

URL: http://svn.apache.org/viewvc?rev=1082011&view=rev
Log:
TRINIDAD-2028 Should reset value on component at the beginning of decode

Thanks to Jing

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

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXEditableValueTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXEditableValueTemplate.java?rev=1082011&r1=1082010&r2=1082011&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXEditableValueTemplate.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXEditableValueTemplate.java Wed Mar 16 00:29:20 2011
@@ -223,6 +223,21 @@ abstract public class UIXEditableValueTe
   @Override
   public void processDecodes(FacesContext context)
   {
+    if (!isValid())
+    {
+      // An exception could occur during normal bean attribute level
+      // validation in update_model phase. When it happens, the component
+      // will have an invalid local value, and LOCAL_VALUE_SET remains
+      // true since we want the invalid value to be shown to end user
+      // to make corrections. But we don't want the invalid state affects
+      // the next request, so we clear the local value and LOCAL_VALUE_SET
+      // property here. While on the other hand, we should not clear the
+      // state when the component is valid, to avoid accidentally clearing
+      // data that other components might depend on.
+
+      setValue(null);
+      setLocalValueSet(false);
+    }
     setValid(true);
 
     // Skip processing if our rendered flag is false