java.lang.IllegalArgumentException: org.springmodules.validation.util.condition.string.MaxLengthStringConditioncan only validation values of the following types: java.lang.String

Spring JIRA | Dehong Pan | 9 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    There is a property of Date type in my entity, I just put JPA annotation @Column(name="xxx") there. in Line 44 of org.springmodules.validation.bean.conf.loader.annotation.handler.jpa.JpaColumnAnnotationHandler Set<Annotation> annotations = getAllPropertyAnnotations(clazz, descriptor); this statement gets the default attribute, length=255. and the following logic is trying to validate the length of this property because there is a "length=255". And then the validation framework will report this exception: java.lang.IllegalArgumentException: org.springmodules.validation.util.condition.string.MaxLengthStringConditioncan only validation values of the following types: java.lang.String at org.springmodules.validation.util.condition.TypeSpecificCondition.beforeObjectChecked(TypeSpecificCondition.java:74) at org.springmodules.validation.util.condition.NonNullAcceptingTypeSpecificCondition.beforeObjectChecked(NonNullAcceptingTypeSpecificCondition.java:43) at org.springmodules.validation.util.condition.AbstractCondition.check(AbstractCondition.java:35) at org.springmodules.validation.util.condition.bean.PropertyBeanCondition.checkBean(PropertyBeanCondition.java:58) at org.springmodules.validation.util.condition.bean.AbstractBeanCondition.doCheck(AbstractBeanCondition.java:39) at org.springmodules.validation.util.condition.AbstractCondition.check(AbstractCondition.java:36) at org.springmodules.validation.bean.BeanValidator.validateAndShortCircuitRules(BeanValidator.java:429) at org.springmodules.validation.bean.BeanValidator.applyPropertiesValidationRules(BeanValidator.java:412) at org.springmodules.validation.bean.BeanValidator.applyBeanValidation(BeanValidator.java:349) at org.springmodules.validation.bean.BeanValidator.validateObjectGraphConstraints(BeanValidator.java:181) at org.springmodules.validation.bean.BeanValidator.validate(BeanValidator.java:99)

    Spring JIRA | 9 years ago | Dehong Pan
    java.lang.IllegalArgumentException: org.springmodules.validation.util.condition.string.MaxLengthStringConditioncan only validation values of the following types: java.lang.String
  2. 0

    There is a property of Date type in my entity, I just put JPA annotation @Column(name="xxx") there. in Line 44 of org.springmodules.validation.bean.conf.loader.annotation.handler.jpa.JpaColumnAnnotationHandler Set<Annotation> annotations = getAllPropertyAnnotations(clazz, descriptor); this statement gets the default attribute, length=255. and the following logic is trying to validate the length of this property because there is a "length=255". And then the validation framework will report this exception: java.lang.IllegalArgumentException: org.springmodules.validation.util.condition.string.MaxLengthStringConditioncan only validation values of the following types: java.lang.String at org.springmodules.validation.util.condition.TypeSpecificCondition.beforeObjectChecked(TypeSpecificCondition.java:74) at org.springmodules.validation.util.condition.NonNullAcceptingTypeSpecificCondition.beforeObjectChecked(NonNullAcceptingTypeSpecificCondition.java:43) at org.springmodules.validation.util.condition.AbstractCondition.check(AbstractCondition.java:35) at org.springmodules.validation.util.condition.bean.PropertyBeanCondition.checkBean(PropertyBeanCondition.java:58) at org.springmodules.validation.util.condition.bean.AbstractBeanCondition.doCheck(AbstractBeanCondition.java:39) at org.springmodules.validation.util.condition.AbstractCondition.check(AbstractCondition.java:36) at org.springmodules.validation.bean.BeanValidator.validateAndShortCircuitRules(BeanValidator.java:429) at org.springmodules.validation.bean.BeanValidator.applyPropertiesValidationRules(BeanValidator.java:412) at org.springmodules.validation.bean.BeanValidator.applyBeanValidation(BeanValidator.java:349) at org.springmodules.validation.bean.BeanValidator.validateObjectGraphConstraints(BeanValidator.java:181) at org.springmodules.validation.bean.BeanValidator.validate(BeanValidator.java:99)

    Spring JIRA | 9 years ago | Dehong Pan
    java.lang.IllegalArgumentException: org.springmodules.validation.util.condition.string.MaxLengthStringConditioncan only validation values of the following types: java.lang.String

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      org.springmodules.validation.util.condition.string.MaxLengthStringConditioncan only validation values of the following types: java.lang.String

      at org.springmodules.validation.util.condition.TypeSpecificCondition.beforeObjectChecked()
    2. org.springmodules.validation
      BeanValidator.validate
      1. org.springmodules.validation.util.condition.TypeSpecificCondition.beforeObjectChecked(TypeSpecificCondition.java:74)
      2. org.springmodules.validation.util.condition.NonNullAcceptingTypeSpecificCondition.beforeObjectChecked(NonNullAcceptingTypeSpecificCondition.java:43)
      3. org.springmodules.validation.util.condition.AbstractCondition.check(AbstractCondition.java:35)
      4. org.springmodules.validation.util.condition.bean.PropertyBeanCondition.checkBean(PropertyBeanCondition.java:58)
      5. org.springmodules.validation.util.condition.bean.AbstractBeanCondition.doCheck(AbstractBeanCondition.java:39)
      6. org.springmodules.validation.util.condition.AbstractCondition.check(AbstractCondition.java:36)
      7. org.springmodules.validation.bean.BeanValidator.validateAndShortCircuitRules(BeanValidator.java:429)
      8. org.springmodules.validation.bean.BeanValidator.applyPropertiesValidationRules(BeanValidator.java:412)
      9. org.springmodules.validation.bean.BeanValidator.applyBeanValidation(BeanValidator.java:349)
      10. org.springmodules.validation.bean.BeanValidator.validateObjectGraphConstraints(BeanValidator.java:181)
      11. org.springmodules.validation.bean.BeanValidator.validate(BeanValidator.java:99)
      11 frames