myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r833310 - /myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISelectBooleanCheckbox.java
Date Fri, 06 Nov 2009 07:59:33 GMT
Author: lofwyr
Date: Fri Nov  6 07:59:33 2009
New Revision: 833310

URL: http://svn.apache.org/viewvc?rev=833310&view=rev
Log:
TOBAGO-277: also check "String", because the type of the convertedValue is String, when there
is no ValueBinding/ValueExpression

Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISelectBooleanCheckbox.java

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISelectBooleanCheckbox.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISelectBooleanCheckbox.java?rev=833310&r1=833309&r2=833310&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISelectBooleanCheckbox.java
(original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISelectBooleanCheckbox.java
Fri Nov  6 07:59:33 2009
@@ -39,14 +39,17 @@
   }
 
   protected void validateValue(FacesContext context, Object convertedValue) {
-    if (isRequired() && convertedValue instanceof Boolean && !((Boolean)
convertedValue)) {
-      FacesMessage facesMessage = MessageFactory.createFacesMessage(context,
-          REQUIRED_MESSAGE_ID, FacesMessage.SEVERITY_ERROR, new Object[]{getId()});
-      context.addMessage(getClientId(context), facesMessage);
-      setValid(false);
-      return;
+    if (isRequired()) {
+      if (convertedValue instanceof Boolean && !((Boolean) convertedValue)
+          // String: e. g. if there is no ValueExpression
+          || convertedValue instanceof String && !Boolean.parseBoolean((String) convertedValue))
{
+        FacesMessage facesMessage = MessageFactory.createFacesMessage(context,
+            REQUIRED_MESSAGE_ID, FacesMessage.SEVERITY_ERROR, new Object[]{getId()});
+        context.addMessage(getClientId(context), facesMessage);
+        setValid(false);
+        return;
+      }
     }
     super.validateValue(context, convertedValue);
-
   }
 }



Mime
View raw message