-->
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.  [ 2 posts ] 
Author Message
 Post subject: ConstraintViolationException constructors in 1.0.CR3
PostPosted: Fri Aug 07, 2009 8:24 am 
Newbie

Joined: Fri Oct 03, 2008 2:30 am
Posts: 16
Location: Neuchâtel, Switzerland
Hi,
there is an error in the definition of the constructors of ConstraintViolationException in validation-api-1.0.CR3.jar.

They are defined
Code:
public <T> ConstraintViolationException(String message, Set<ConstraintViolation<?>> constraintViolations) { ... }
public <T> ConstraintViolationException(Set<ConstraintViolation<?>> constraintViolations) { ... }
but should be
Code:
public <T> ConstraintViolationException(String message, Set<ConstraintViolation<T>> constraintViolations) { ... }
public <T> ConstraintViolationException(Set<ConstraintViolation<T>> constraintViolations) { ... }
Otherwise you have to create an intermediate collection to use them (casts are not allowed here). E.g:
Code:
Set<ConstraintViolation<MyBean>> violations = validator.validateValue(MyBean.class, "field", value);
if (!violations.isEmpty()) {
  throw new ConstraintViolationException(new HashSet<ConstraintViolation<?>>(violations));
}
I would have open an JIRA issue, but I'm not sure where (http://opensource.atlassian.com/projects/hibernate/browse/BVAL?)


Top
 Profile  
 
 Post subject: Re: ConstraintViolationException constructors in 1.0.CR3
PostPosted: Thu Aug 20, 2009 4:49 am 
Newbie

Joined: Thu Aug 20, 2009 3:18 am
Posts: 2
Thank you for the information you provided. It helped alot.



comparatif simulation assurance vie multisupport - simulation assurance vie ! Les sites de simulation assurance viecomparatif simulation assurance vie multisupport


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.