java.lang.NullPointerException

Hibernate JIRA | Eddy Verbruggen | 8 years ago
  1. 0

    My Validator classes extend a common superclass, which in turn implements the ConstraintValidator interface. This version of Hibernate Validator can't cope with that class structure due to a little bug in ValidatorTypeHelper.resolveTypes. The last bit of that method calls itself recursively, but ignores returnvalues, so the code always falls through to "return null". else { resolveTypes( resolvedTypes, rawType.getGenericSuperclass() ); for ( Type genericInterface : rawType.getGenericInterfaces() ) { resolveTypes( resolvedTypes, genericInterface ); } } } //else we don't care I think return null; Can it be changed to something like this please: else { Type returnedType = resolveTypes( resolvedTypes, rawType.getGenericSuperclass() ); if ( returnedType != null ) { return returnedType; } for ( Type genericInterface : rawType.getGenericInterfaces() ) { returnedType = resolveTypes( resolvedTypes, genericInterface ); if ( returnedType != null ) { return returnedType; } } } } //else we don't care I think return null; The stacktrace is: java.lang.NullPointerException at org.hibernate.validation.util.ValidatorTypeHelper.extractType(ValidatorTypeHelper.java:68) at org.hibernate.validation.util.ValidatorTypeHelper.getValidatorsTypes(ValidatorTypeHelper.java:57) at org.hibernate.validation.engine.ConstraintTree.findMatchingValidatorClass(ConstraintTree.java:163) at org.hibernate.validation.engine.ConstraintTree.getInitalizedValidator(ConstraintTree.java:144) at org.hibernate.validation.engine.ConstraintTree.validateConstraints(ConstraintTree.java:113) at org.hibernate.validation.engine.MetaConstraint.validateConstraint(MetaConstraint.java:126) at org.hibernate.validation.engine.ValidatorImpl.validatePropertyForGroup(ValidatorImpl.java:419) at org.hibernate.validation.engine.ValidatorImpl.validateProperty(ValidatorImpl.java:373) at org.hibernate.validation.engine.ValidatorImpl.validateProperty(ValidatorImpl.java:132)

    Hibernate JIRA | 8 years ago | Eddy Verbruggen
    java.lang.NullPointerException
  2. 0

    My Validator classes extend a common superclass, which in turn implements the ConstraintValidator interface. This version of Hibernate Validator can't cope with that class structure due to a little bug in ValidatorTypeHelper.resolveTypes. The last bit of that method calls itself recursively, but ignores returnvalues, so the code always falls through to "return null". else { resolveTypes( resolvedTypes, rawType.getGenericSuperclass() ); for ( Type genericInterface : rawType.getGenericInterfaces() ) { resolveTypes( resolvedTypes, genericInterface ); } } } //else we don't care I think return null; Can it be changed to something like this please: else { Type returnedType = resolveTypes( resolvedTypes, rawType.getGenericSuperclass() ); if ( returnedType != null ) { return returnedType; } for ( Type genericInterface : rawType.getGenericInterfaces() ) { returnedType = resolveTypes( resolvedTypes, genericInterface ); if ( returnedType != null ) { return returnedType; } } } } //else we don't care I think return null; The stacktrace is: java.lang.NullPointerException at org.hibernate.validation.util.ValidatorTypeHelper.extractType(ValidatorTypeHelper.java:68) at org.hibernate.validation.util.ValidatorTypeHelper.getValidatorsTypes(ValidatorTypeHelper.java:57) at org.hibernate.validation.engine.ConstraintTree.findMatchingValidatorClass(ConstraintTree.java:163) at org.hibernate.validation.engine.ConstraintTree.getInitalizedValidator(ConstraintTree.java:144) at org.hibernate.validation.engine.ConstraintTree.validateConstraints(ConstraintTree.java:113) at org.hibernate.validation.engine.MetaConstraint.validateConstraint(MetaConstraint.java:126) at org.hibernate.validation.engine.ValidatorImpl.validatePropertyForGroup(ValidatorImpl.java:419) at org.hibernate.validation.engine.ValidatorImpl.validateProperty(ValidatorImpl.java:373) at org.hibernate.validation.engine.ValidatorImpl.validateProperty(ValidatorImpl.java:132)

    Hibernate JIRA | 8 years ago | Eddy Verbruggen
    java.lang.NullPointerException
  3. 0

    Android: Saving Map State in Google map

    Stack Overflow | 11 months ago | Junie Negentien
    java.lang.RuntimeException: Unable to resume activity {com.ourThesis.junieNegentien2015/com.ourThesis.junieNegentien2015.MainActivity}: java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    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.NullPointerException

      No message provided

      at org.hibernate.validation.util.ValidatorTypeHelper.extractType()
    2. org.hibernate.validation
      ValidatorImpl.validateProperty
      1. org.hibernate.validation.util.ValidatorTypeHelper.extractType(ValidatorTypeHelper.java:68)
      2. org.hibernate.validation.util.ValidatorTypeHelper.getValidatorsTypes(ValidatorTypeHelper.java:57)
      3. org.hibernate.validation.engine.ConstraintTree.findMatchingValidatorClass(ConstraintTree.java:163)
      4. org.hibernate.validation.engine.ConstraintTree.getInitalizedValidator(ConstraintTree.java:144)
      5. org.hibernate.validation.engine.ConstraintTree.validateConstraints(ConstraintTree.java:113)
      6. org.hibernate.validation.engine.MetaConstraint.validateConstraint(MetaConstraint.java:126)
      7. org.hibernate.validation.engine.ValidatorImpl.validatePropertyForGroup(ValidatorImpl.java:419)
      8. org.hibernate.validation.engine.ValidatorImpl.validateProperty(ValidatorImpl.java:373)
      9. org.hibernate.validation.engine.ValidatorImpl.validateProperty(ValidatorImpl.java:132)
      9 frames