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

Hibernate JIRA | Steffen Ryll | 1 year ago
  1. 0

    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}

    Hibernate JIRA | 1 year ago | Steffen Ryll
    java.lang.IllegalArgumentException: HV000040: Property path must provide index or map key.
  2. 0

    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}

    Hibernate JIRA | 1 year ago | Steffen Ryll
    java.lang.IllegalArgumentException: HV000040: Property path must provide index or map key.
  3. 0

    Hibernate Validator - calling validateProperty(object,"list[0].field1",groups) on nested list item throws IllegalArgumentException

    Stack Overflow | 5 years ago | Gary
    java.lang.IllegalArgumentException: HV000039: Invalid property path. There is no property field1 in entity java.util.ArrayList.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Exception after successful auth, request not forwarded to controller

    GitHub | 2 years ago | naresha
    java.lang.IllegalArgumentException: URL mapping must either provide redirect information, a controller or a view name to map to!
  6. 0

    GitHub comment 659#240123914

    GitHub | 4 months ago | alexmoore
    java.lang.IllegalArgumentException: An index key or range or coverageContext must be supplied

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      HV000040: Property path must provide index or map key.

      at org.hibernate.validator.internal.engine.ValidatorImpl.collectMetaConstraintsForPath()
    2. Hibernate Validator Engine
      ValidatorImpl.validateProperty
      1. org.hibernate.validator.internal.engine.ValidatorImpl.collectMetaConstraintsForPath(ValidatorImpl.java:1455)
      2. org.hibernate.validator.internal.engine.ValidatorImpl.validatePropertyInContext(ValidatorImpl.java:796)
      3. org.hibernate.validator.internal.engine.ValidatorImpl.validateProperty(ValidatorImpl.java:219)
      3 frames
    3. org.hibernate.validator
      ValidatorTest.testValidatePropertyWithNestedSetPath
      1. org.hibernate.validator.test.internal.engine.ValidatorTest.testValidatePropertyWithNestedSetPath(ValidatorTest.java:243)
      1 frame