-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Bean Validation 2.0 CR3. Medellin JUG Results test
PostPosted: Sun Jul 16, 2017 5:40 pm 
Newbie

Joined: Thu Apr 27, 2017 8:04 am
Posts: 4
Last week, our JUG was working with the BV CR-3, we tested it, but had some issues, we posted the result on our site: https://medellinjug.org/.

[url]
https://medellinjug.org/2017/07/16/adop ... tested-it/[/url]

You can pull the code from github https://github.com/medellinjug/beanvalidation-2.0

We tested the new annotations @NotBlank, @NotEmpty, @Email, @FutureOrPresent, @PastOrPresent, @Positive,@PositiveOrZero, @Negative and @NegativeOrZero. Some of them with some issues:

Image

1. There are two diferents languages : @NotBlank, @NotEmpty are in Spanish, the others in English.

2. Two annotations don’t show messages for the validation:@FutureOrPresent and @PastOrPresent

3. @Email validate only the input has a “@” and some text after the @,

4. @FutureOrPresent goes well if the date is next year, with a future date of the this year (2017) there is a validation message, and @PastOrPresent with a future date in the actual ayer (2017) the validation was ignored

Image

We will be grateful if you says us what can be the problems


Top
 Profile  
 
 Post subject: Re: Bean Validation 2.0 CR3. Medellin JUG Results test
PostPosted: Mon Aug 07, 2017 12:56 pm 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 388
Hi Hilmer,

Thanks a lot for getting in touch and trying out the BV CR 3. On your questions:

Quote:
1. There are two diferents languages : @NotBlank, @NotEmpty are in Spanish, the others in English.


Should be fixed thanks to your patch to the RI :)

Quote:
2. Two annotations don’t show messages for the validation:@FutureOrPresent and @PastOrPresent


Good catch. They were added for the Final release.

Quote:
3. @Email validate only the input has a “@” and some text after the @,


The spec doesn't mandate any specific check for @Email, i.e. it's dependent on the implementation. That said, I'd expect you to get a failure (with the RI) if there an "@" but nothing before that (i.e. "@example.com" should be marked as invalid). Could you try out that one?

4. @FutureOrPresent goes well if the date is next year ...

Could you ellaborate a bit on this one? What is your validated data type? And what are the exact values you are validating? In general, the ...OrPresent constraints consider the entire current "date" as valid. What that is, depends on the validated data type, i.e. for Year, the entire current year would be considered valid, for YearMonth, the entire current month would be considered valid and so on.

Thanks a lot for your feedback,

--Gunnar

_________________
Visit my blog at http://musingsofaprogrammingaddict.blogspot.com/


Top
 Profile  
 
 Post subject: Re: Bean Validation 2.0 CR3. Medellin JUG Results test
PostPosted: Fri Aug 11, 2017 4:33 pm 
Newbie

Joined: Thu Apr 27, 2017 8:04 am
Posts: 4
Hi Gunnar,

We wanna clarify our findings

@Email: We test these values

hilmer@gmail.com Validations said it's a valid e-mail address
hilmer@ Validations said it's an invalid e-mail address
hilmer@gmail Validations said it's a valid e-mail address.

Our doubt is why the last one (hilmer@gmail) pass the validation if this e-mail address is not recognised as a valid e-mail, We had proposed a change on the class engine/src/main/java/org/hibernate/validator/internal/util/DomainNameUtil.java


@FutureOrPresent
We used java.util.Date, the values were
01/01/2017 Validations said it's valid
01/01/2018 Validations said it's valid

Our doubt is why did the validation take January First 2017 as a value of the present, this test was using Java Server Faces, but We made a second test on a local java Class, this test said 01/01/2017 is not a date in the present or the future.


Top
 Profile  
 
 Post subject: Re: Bean Validation 2.0 CR3. Medellin JUG Results test
PostPosted: Mon Aug 14, 2017 2:42 am 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 388
Hi Hilmer,

Thanks for providing feedback on all these issues, that's much appreciated!

Quote:
Our doubt is why the last one (hilmer@gmail) pass the validation


We consider this in the RI as valid, as e.g. hilmer@localhost would be a valid address. IIUC, single-part domain names are valid (although uncommon). You can add a stricter validation via @Email#regexp().

Quote:
Our doubt is why did the validation take January First 2017 as a value of the present, this test was using Java Server Faces, but We made a second test on a local java Class, this test said 01/01/2017 is not a date in the present or the future.


That's a bit weird, perhaps you accidentally used another date in your JSF test? If it works with a simple Java class, I'd say nothing is wrong within the RI.

Thanks,

--Gunnar

_________________
Visit my blog at http://musingsofaprogrammingaddict.blogspot.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.