or a custom composite constraint which is annotated with @Email and
@NotNull and (@Size or @NotEmpty)
(or a normal custom constraint which handles it differently)

regards,
gerhard



2013/2/28 Nick Chalko <[email protected]>

> in other words add
> @NotNull
>
>
> On Thu, Feb 28, 2013 at 2:18 PM, Gerhard Petracek <
> [email protected]> wrote:
>
>> hi matthew,
>>
>> that's perfectly fine according to the specification.
>> handling null and empty values should be done by the
>> constraint-validator/s which are responsible for those values.
>>
>> regards,
>> gerhard
>>
>>
>>
>> 2013/2/28 Matthew Adams <[email protected]>
>>
>>> 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:[email protected] <[email protected]>
>>> skype:matthewadams12
>>> googletalk:[email protected]
>>> http://matthewadams.me
>>> http://www.linkedin.com/in/matthewadams
>>>
>>
>>
>
>
> --
> Nick Chalko | Software Engineer | [email protected] |   :-)
> Generate your java flags for easier testing.
> go/java_flags
>

Reply via email to