Kamil created WICKET-6383:
-----------------------------

             Summary: PropertyValidator throws Exception when Model is empty
                 Key: WICKET-6383
                 URL: https://issues.apache.org/jira/browse/WICKET-6383
             Project: Wicket
          Issue Type: Bug
          Components: wicket-bean-validation
            Reporter: Kamil


During creation of PropertyValidator if Model is empty (it is set during 
runtime):
{code}
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);
{code}
an exception is thrown:
{code}
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]]
{code}
without this line:
{code}
tf.add(new PropertyValidator<>());
{code}
everything works



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to