[jboss-user] [JBoss Seam] - Re: Validation throws an exception instead of redisplaying t
anescu
do-not-reply at jboss.com
Fri Jun 22 11:33:55 EDT 2007
"pete.muir at jboss.org" wrote : You've probably got the problem described here:
|
| http://wiki.jboss.org/wiki/Wiki.jsp?page=SeamProblemsFAQ regard @NotNull, @Length etc.
Hi,
I have the same problem with an @Email annotated field.
The problem is that the field can allow null values (so no @NotNull, the field is nullable in the DB). It throws the same error as this thread describes. I looked into the EmailValidator and for a null/empty string it shoul be a valid email. And still I get the InvalidStateException...
public boolean isValid(Object value) {
| if ( value == null ) return true;
| if ( !( value instanceof String ) ) return false;
| String string = (String) value;
| if ( string.length() == 0 ) return true;
| Matcher m = pattern.matcher( string );
| return m.matches();
| }
I also have the same problem with a field marked with @Pattern. If the field is empty (and also is not required), when the page is saved I get to the debug page with a stacktrace and again the cause is InvalidStateException
I looked into the Pattern isValid method from SVN and it doesn't check if the field is of length 0 ( aka '' - empty string).
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4056931#4056931
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4056931
More information about the jboss-user
mailing list