bval-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Adams <matt...@matthewadams.me>
Subject Why does EmailValidator match null & ""?
Date Thu, 28 Feb 2013 21:33:32 GMT
Email validator seems to consider null and empty string ("") valid email.
 See
https://svn.apache.org/repos/asf/bval/trunk/bval-core/src/main/java/org/apache/bval/routines/EMailValidationUtils.java:

    public static boolean isValid(Object value, Pattern aPattern) {*
     if (value == null)
            return true;
        if (!(value instanceof CharSequence))
            return false;
        CharSequence seq = (CharSequence) value;
        if (seq.length() == 0)
            return true;*
        Matcher m = aPattern.matcher(seq);
        return m.matches();
    }

That surprises me.  Does it surprise anyone else?  Can we get that changed?
 I'd be happy to file an issue (and patch).

-matthew

-- 
mailto:matthew@matthewadams.me <matthew@matthewadams.me>
skype:matthewadams12
googletalk:matthew@matthewadams.me
http://matthewadams.me
http://www.linkedin.com/in/matthewadams

Mime
View raw message