Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-6383

PropertyValidator throws Exception when Model is empty

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Invalid
    • None
    • None
    • wicket-bean-validation
    • None

    Description

      During creation of PropertyValidator if Model is empty (it is set during runtime):

      IModel<User> model = new Model<>();
      		CompoundPropertyModel<User> compound = new CompoundPropertyModel<>(model);
      		TextField<String> tf = new TextField<>("email", compound.bind("email"));
      		tf.add(new PropertyValidator<>());
      		add(tf);
      

      an exception is thrown:

      Last cause: Could not resolve Bean Property from component: [TextField [Component id = email]]. (Hints:) Possible causes are a typo in the PropertyExpression, a null reference or a model that does not work in combination with a IPropertyResolver. Model : Model:classname=[org.apache.wicket.model.PropertyModel]:nestedModel=[Model:classname=[org.apache.wicket.model.CompoundPropertyModel]:nestedModel=[Model:classname=[org.apache.wicket.model.Model]:object=[null]]]:expression=[email]
      WicketMessage: Error attaching this container for rendering: [UserPanel [Component id = formPanel]]
      

      without this line:

      tf.add(new PropertyValidator<>());
      

      everything works

      Attachments

        Activity

          People

            svenmeier Sven Meier
            eximius Kamil
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: