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 2009/11/17 22:54:14 UTC

svn commit: r881555 - in /myfaces/core/trunk/api/src: main/java/javax/faces/component/UIInput.java test/java/javax/faces/component/UIInputTest.java

Author: lu4242
Date: Tue Nov 17 21:54:13 2009
New Revision: 881555

URL: http://svn.apache.org/viewvc?rev=881555&view=rev
Log:
restore EMPTY_VALUES_AS_NULL_PARAM_NAME constant

Modified:
    myfaces/core/trunk/api/src/main/java/javax/faces/component/UIInput.java
    myfaces/core/trunk/api/src/test/java/javax/faces/component/UIInputTest.java

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/component/UIInput.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIInput.java?rev=881555&r1=881554&r2=881555&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/component/UIInput.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/component/UIInput.java Tue Nov 17 21:54:13 2009
@@ -58,8 +58,10 @@
     public static final String UPDATE_MESSAGE_ID = "javax.faces.component.UIInput.UPDATE";
     private static final String ERROR_HANDLING_EXCEPTION_LIST = "org.apache.myfaces.errorHandling.exceptionList";
 
-    //TODO: Remove this constant
-    //public static final String EMPTY_VALUES_AS_NULL_PARAM_NAME = "javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL";
+    // -=Leonardo Uribe =- According to http://wiki.java.net/bin/view/Projects/Jsf2MR1ChangeLog 
+    // this constant will be made public on 2.1. For now, since this param is handled in
+    // 2.0, we should do it as well.
+    private static final String EMPTY_VALUES_AS_NULL_PARAM_NAME = "javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL";
     public static final String VALIDATE_EMPTY_FIELDS_PARAM_NAME = "javax.faces.VALIDATE_EMPTY_FIELDS";
 
     private static final Validator[] EMPTY_VALIDATOR_ARRAY = new Validator[0];
@@ -482,15 +484,15 @@
             }
 
             // Begin new JSF 2.0 requirement (INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL)
-            // String contextParam = context.getExternalContext().getInitParameter(EMPTY_VALUES_AS_NULL_PARAM_NAME);
-            //if (contextParam != null && contextParam.toLowerCase().equals("true"))
-            //{
-            //    if (submittedValue.toString().length() == 0)
-            //    {
-            //        setSubmittedValue(null);
-            //        submittedValue = null;
-            //    }
-            //}
+            String contextParam = context.getExternalContext().getInitParameter(EMPTY_VALUES_AS_NULL_PARAM_NAME);
+            if (contextParam != null && contextParam.toLowerCase().equals("true"))
+            {
+                if (submittedValue.toString().length() == 0)
+                {
+                    setSubmittedValue(null);
+                    submittedValue = null;
+                }
+            }
             // End new JSF 2.0 requirement (INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL)
 
             Object convertedValue = getConvertedValue(context, submittedValue);

Modified: myfaces/core/trunk/api/src/test/java/javax/faces/component/UIInputTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/test/java/javax/faces/component/UIInputTest.java?rev=881555&r1=881554&r2=881555&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/test/java/javax/faces/component/UIInputTest.java (original)
+++ myfaces/core/trunk/api/src/test/java/javax/faces/component/UIInputTest.java Tue Nov 17 21:54:13 2009
@@ -125,7 +125,6 @@
         assertEquals("testValue", updatedValue);
     }
 
-    /*
     public void testValidateWithEmptyStringWithEmptyStringAsNullEnabled()
     {
         try
@@ -144,7 +143,6 @@
             facesContext.setExternalContext(externalContext);
         }
     }
-    */
 
     public void testValidateWithNonEmptyStringWithEmptyStringAsNullEnabled()
     {