summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHenri Sara <henri.sara@itmill.com>2010-10-15 12:28:55 +0000
committerHenri Sara <henri.sara@itmill.com>2010-10-15 12:28:55 +0000
commit8eb3164845d8d44877d2b6231836cd2e02dcab85 (patch)
tree43c2945e8de532341994ebdaff61958898f463bb /src
parenta420326fbed1443c5b9e085adf7a2a4ae651954c (diff)
downloadvaadin-framework-8eb3164845d8d44877d2b6231836cd2e02dcab85.tar.gz
vaadin-framework-8eb3164845d8d44877d2b6231836cd2e02dcab85.zip
#5785 AbstractStringValidator should convert non-string values
svn changeset:15564/svn branch:6.4
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/data/validator/AbstractStringValidator.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/com/vaadin/data/validator/AbstractStringValidator.java b/src/com/vaadin/data/validator/AbstractStringValidator.java
index 359d83ef10..90778e16b1 100644
--- a/src/com/vaadin/data/validator/AbstractStringValidator.java
+++ b/src/com/vaadin/data/validator/AbstractStringValidator.java
@@ -42,20 +42,21 @@ public abstract class AbstractStringValidator extends AbstractValidator {
* Tests if the given value is a valid string.
* <p>
* Null values are always accepted. Values that are not {@link String}s are
- * always rejected. Uses {@link #isValidString(String)} to validate the
- * value.
+ * converted using {@link #toString()}. Then {@link #isValidString(String)}
+ * is used to validate the value.
* </p>
*
* @param value
* the value to check
- * @return true if the value is a valid string, false otherwise
+ * @return true if the value (or its toString()) is a valid string, false
+ * otherwise
*/
public boolean isValid(Object value) {
if (value == null) {
return true;
}
if (!(value instanceof String)) {
- return false;
+ value = String.valueOf(value);
}
return isValidString((String) value);
}