Author: hlship
Date: Tue Apr 15 14:44:36 2008
New Revision: 648426

URL: http://svn.apache.org/viewvc?rev=648426&view=rev
Log:
TAPESTRY-2253: A brain dead implementation of toString() on a custom data 
object can cause the Required validator to throw a NullPointerExcepton

Modified:
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/validator/Required.java

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/validator/Required.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/validator/Required.java?rev=648426&r1=648425&r2=648426&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/validator/Required.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/validator/Required.java
 Tue Apr 15 14:44:36 2008
@@ -18,6 +18,7 @@
 import org.apache.tapestry.MarkupWriter;
 import org.apache.tapestry.ValidationException;
 import org.apache.tapestry.ioc.MessageFormatter;
+import org.apache.tapestry.ioc.internal.util.InternalUtils;
 import org.apache.tapestry.services.FormSupport;
 
 /**
@@ -33,7 +34,8 @@
     public void validate(Field field, Void constraintValue, MessageFormatter 
formatter, Object value)
             throws ValidationException
     {
-        if (value == null || value.toString().equals("")) throw new 
ValidationException(buildMessage(formatter, field));
+        if (value == null || InternalUtils.isBlank(value.toString()))
+            throw new ValidationException(buildMessage(formatter, field));
     }
 
     private String buildMessage(MessageFormatter formatter, Field field)


Reply via email to