[hibernate-issues] [Hibernate-JIRA] Commented: (HV-208) Wrong Path in ConstrinViolations

Alexey Romanchuk (JIRA) noreply at atlassian.com
Mon Aug 17 05:57:15 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HV-208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33771#action_33771 ] 

Alexey Romanchuk commented on HV-208:
-------------------------------------

I test it on latest snapshot you made for me in snapshots.maven.org.
Here it is testcase. I got ".start" instead of "start"

@Target( ElementType.TYPE )
@Retention( RetentionPolicy.RUNTIME )
@Constraint( validatedBy = StartLessThatEndImpl.class )
public @interface StartLessThatEnd
{
  String message() default "x";

  Class<?>[] groups() default {};
  
  Class<? extends ConstraintPayload>[] payload() default { };
}


class Item
{
  @Valid
  Interval interval;
}


@StartLessThatEnd
class Interval
{
  int start;

  int end;
}


public class ValidatorTest
{
  public static void main( String[] args )
  {
    Item item = new Item();
    item.interval = new Interval();
    item.interval.start = 10;
    item.interval.end = 5;
    
    ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
    ConstraintViolation<Interval> c = factory.getValidator().validate( item.interval ).iterator().next();
    System.out.println( c.getPropertyPath() );

  }
}

> Wrong Path in ConstrinViolations
> --------------------------------
>
>                 Key: HV-208
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-208
>             Project: Hibernate Validator
>          Issue Type: Bug
>          Components: engine
>    Affects Versions: 4.0.0.Beta3
>         Environment: beta 3 snapshot from aug 11
>            Reporter: Alexey Romanchuk
>            Assignee: Hardy Ferentschik
>            Priority: Critical
>             Fix For: 4.0.0.CR1
>
>   Original Estimate: 1 hour
>  Remaining Estimate: 1 hour
>
> In Path we always have leading dot for every validate field. 
> class A
> {
> @NotNull
> String b;
> }
> causes ".b" in Path when @NotNull fails

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list