java.lang.IllegalArgumentException: HV000040: Property path must provide index or map key.

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Whenever you pass a property path like {{list\[0\].foo}} to {{Validator#validateProperty}}, an exception is thrown: {noformat} java.lang.IllegalArgumentException: HV000040: Property path must provide index or map key. at org.hibernate.validator.internal.engine.ValidatorImpl.collectMetaConstraintsForPath(ValidatorImpl.java:1455) at org.hibernate.validator.internal.engine.ValidatorImpl.validatePropertyInContext(ValidatorImpl.java:796) at org.hibernate.validator.internal.engine.ValidatorImpl.validateProperty(ValidatorImpl.java:219) at org.hibernate.validator.test.internal.engine.ValidatorTest.testValidatePropertyWithNestedSetPath(ValidatorTest.java:243) {noformat} (The actual message and error code differs between 4.3 and 5.1, but the issue is the same. With HV 4.1, it does work.) If you pass the same property path to {{Validator#validateValue}} (like in the existing unit tests), it works fine. The unit test for {{Validator#validateValue}} has been created as part of HV-596. However, I suspect the issue was introduced with HV-395. I have a attached an enhanced version of the latest ValidatorTest where following two tests fail with mentioned exception: {code} @Test @TestForIssue(jiraKey = "HV-xyz") public void testValidatePropertyWithNestedPath() { Validator validator = getValidator(); X someX = new X(); someX.addZ( new Z() ); Set<ConstraintViolation<X>> constraintViolations = validator.validateProperty( someX, "list[0].foo" ); assertNumberOfViolations( constraintViolations, 1 ); assertCorrectPropertyPaths( constraintViolations, "list[0].foo" ); } @Test @TestForIssue(jiraKey = "HV-xyz") public void testValidatePropertyWithNestedSetPath() { Validator validator = getValidator(); XX someObject = new XX(); someObject.addZ( new Z() ); Set<ConstraintViolation<XX>> constraintViolations = validator.validateProperty( someObject, "set[0].foo" ); assertNumberOfViolations( constraintViolations, 1 ); assertCorrectPropertyPaths( constraintViolations, "set[0].foo" ); } {code}
    via by Steffen Ryll,
  • Whenever you pass a property path like {{list\[0\].foo}} to {{Validator#validateProperty}}, an exception is thrown: {noformat} java.lang.IllegalArgumentException: HV000040: Property path must provide index or map key. at org.hibernate.validator.internal.engine.ValidatorImpl.collectMetaConstraintsForPath(ValidatorImpl.java:1455) at org.hibernate.validator.internal.engine.ValidatorImpl.validatePropertyInContext(ValidatorImpl.java:796) at org.hibernate.validator.internal.engine.ValidatorImpl.validateProperty(ValidatorImpl.java:219) at org.hibernate.validator.test.internal.engine.ValidatorTest.testValidatePropertyWithNestedSetPath(ValidatorTest.java:243) {noformat} (The actual message and error code differs between 4.3 and 5.1, but the issue is the same. With HV 4.1, it does work.) If you pass the same property path to {{Validator#validateValue}} (like in the existing unit tests), it works fine. The unit test for {{Validator#validateValue}} has been created as part of HV-596. However, I suspect the issue was introduced with HV-395. I have a attached an enhanced version of the latest ValidatorTest where following two tests fail with mentioned exception: {code} @Test @TestForIssue(jiraKey = "HV-xyz") public void testValidatePropertyWithNestedPath() { Validator validator = getValidator(); X someX = new X(); someX.addZ( new Z() ); Set<ConstraintViolation<X>> constraintViolations = validator.validateProperty( someX, "list[0].foo" ); assertNumberOfViolations( constraintViolations, 1 ); assertCorrectPropertyPaths( constraintViolations, "list[0].foo" ); } @Test @TestForIssue(jiraKey = "HV-xyz") public void testValidatePropertyWithNestedSetPath() { Validator validator = getValidator(); XX someObject = new XX(); someObject.addZ( new Z() ); Set<ConstraintViolation<XX>> constraintViolations = validator.validateProperty( someObject, "set[0].foo" ); assertNumberOfViolations( constraintViolations, 1 ); assertCorrectPropertyPaths( constraintViolations, "set[0].foo" ); } {code}
    via by Steffen Ryll,
    • java.lang.IllegalArgumentException: HV000040: Property path must provide index or map key. at org.hibernate.validator.internal.engine.ValidatorImpl.collectMetaConstraintsForPath(ValidatorImpl.java:1455) at org.hibernate.validator.internal.engine.ValidatorImpl.validatePropertyInContext(ValidatorImpl.java:796) at org.hibernate.validator.internal.engine.ValidatorImpl.validateProperty(ValidatorImpl.java:219) at org.hibernate.validator.test.internal.engine.ValidatorTest.testValidatePropertyWithNestedSetPath(ValidatorTest.java:243)
    No Bugmate found.