You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2009/12/02 15:17:47 UTC
svn commit: r886153 -
/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIInput.java
Author: matzew
Date: Wed Dec 2 14:17:47 2009
New Revision: 886153
URL: http://svn.apache.org/viewvc?rev=886153&view=rev
Log:
some more clean-ups on the UIInput class...
Modified:
myfaces/core/trunk/api/src/main/java/javax/faces/component/UIInput.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=886153&r1=886152&r2=886153&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 Wed Dec 2 14:17:47 2009
@@ -329,10 +329,13 @@
protected void validateValue(FacesContext context, Object convertedValue)
{
- boolean empty = convertedValue == null
- || (convertedValue instanceof String && ((String) convertedValue).length() == 0);
+ if (!isValid())
+ return;
+
+ // If our value is empty, check the required property
+ boolean isEmpty = isEmpty(convertedValue);
- if (isValid() && isRequired() && empty)
+ if (isRequired() && isEmpty)
{
if (getRequiredMessage() != null)
{
@@ -349,7 +352,7 @@
return;
}
- if (!empty || shouldValidateEmptyFields(context))
+ if (!isEmpty || shouldValidateEmptyFields(context))
{
_ComponentUtils.callValidators(context, this, convertedValue);
}
@@ -1046,7 +1049,7 @@
}
else if (value instanceof String)
{
- if ( ((String)value).length() <= 0 )
+ if ( ((String)value).trim().length() <= 0 )
{
return true;
}