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

Hibernate JIRA | Steffen Ryll | 2 years 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 | 2 years 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 | 2 years 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
    Some bots are sending malformed HTTP requests to your site. Try to find their IP addresses in the access logs and ask them to fix the bots or blacklist them.
  6. 0
    This error is caused by malformed HTTP request. You are trying to access unsecured page through https.

    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