You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2008/04/15 23:44:37 UTC
svn commit: r648426 -
/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/validator/Required.java
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)