Uploaded image for project: 'Spring Modules'
  1. Spring Modules
  2. MOD-391

org.springframework.beans.NullValueInNestedPathException for nested properties in case of null value

    Details

    • Type: Bug
    • Status: Open
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: 0.8
    • Fix Version/s: None
    • Component/s: VALIDATION
    • Labels:
      None
    • Environment:
      jdk 1.5.12, spring 2.0rc2, spring-modules 0.8

      Description

      I use the following validation rules:

      {deal: ? not null : 'deal' : 'errors.required.deal' : 101} {deal.client: ? not null : 'deal client' : 'errors.required.deal.client' : 102}

      I have deal != null and deal.client ==null. The second rule have to find this issue and add error into collection. But, i get the following error:
      org.springframework.beans.NullValueInNestedPathException: Invalid property 'deal.client' of bean class [com.db.gcf.gbcrm.pipelinedeals.pipelinedeals.web.webflows.actions.PlDealsDealFormBean]: Value of nested property 'deal.client' is null
      at org.springframework.beans.BeanWrapperImpl.getNestedBeanWrapper(BeanWrapperImpl.java:387)
      at org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:362)
      at org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:363)
      at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:468)
      at org.springmodules.validation.valang.functions.BeanPropertyFunction.getResult(BeanPropertyFunction.java:59)
      at org.springmodules.validation.valang.predicates.GenericTestPredicate.evaluate(GenericTestPredicate.java:60)
      at org.springmodules.validation.valang.predicates.BasicValidationRule.validate(BasicValidationRule.java:124)
      at org.springmodules.validation.valang.ValangValidator.validate(ValangValidator.java:194)
      at com.db.gcf.gbcrm.pipelinedeals.pipelinedeals.web.webflows.PlDealsEditValidationTest.testMandatoryFields(PlDealsEditValidationTest.java:36)
      ...
      In my opinion you must catch this exception and pass null value into parser. Note, that in general i can't use standalone validator for standalone objects as rules are generally interconnected between objects tree.

        Activity

        Hide
        yatesco Colin Yates added a comment -

        This sounds like a sane approach.

        Uri,

        How much work do you think this would entail, and can it be done for 0.9?

        Show
        yatesco Colin Yates added a comment - This sounds like a sane approach. Uri, How much work do you think this would entail, and can it be done for 0.9?

          People

          • Assignee:
            uboness Uri Boness
            Reporter:
            sponomarev Sergey Ponomarev
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development