You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by David Chang <da...@yahoo.com> on 2010/04/06 15:58:39 UTC

Re: Properties of model are set to NULL even though we have setRequired set to true

Hello Wayne,

I understand your frustration. Recently, I got a similar case but it eventually turned out that it was my fault due to being new in Wicket. Long story short, for a dropdownchoice list with loadabledetachablemodel, I set up a load method, but in another place, I used dropdownchoice#setChoices to update the list for ajax update. This method actually changes the model, but i did not know about its impact. I spent almost a whole day to figure out why the load method did not get called again.

So in your case, there MUST be a reason. Look everywhere these fields get changed. 

Good luck!
David


--- On Tue, 4/6/10, nino martinez wael <ni...@gmail.com> wrote:

> From: nino martinez wael <ni...@gmail.com>
> Subject: Re: Properties of model are set to NULL even though we have  setRequired set to true
> To: users@wicket.apache.org
> Date: Tuesday, April 6, 2010, 9:51 AM
> Hi Wayne
> 
> I guess you've tried debugging it, so it's not a consistent
> error? Are
> you using any special web container or is wrapped somehow
> (like
> terracotta)?
> 
> 2010/4/6 Wayne Pope <wa...@googlemail.com>:
> > Hi,
> >
> > has anyone got any idea about this? I'm still
> 'spinning my wheels' on it.
> >
> > thanks for any help.
> >
> > On Fri, Apr 2, 2010 at 5:00 PM, Wayne Pope
> > <wa...@googlemail.com>
> wrote:
> >> Hi,
> >>
> >> we've got several examples in our logs of
> properties of the model
> >> being set to null even though the textfield is set
> to required.
> >> I have NO idea how on earth this can happen - its
> just doesn't make
> >> sense - and its really frustrating me!!
> >>
> >> here's an example:
> >>
> >> Caused by: java.lang.NullPointerException
> >>        at
> org.apache.commons.codec.digest.DigestUtils.md5(DigestUtils.java:86)
> >>        at
> org.apache.commons.codec.digest.DigestUtils.md5Hex(DigestUtils.java:108)
> >>        at
> hub.app.wicket.admin.ChangePasswordPage$1.onSubmit(ChangePasswordPage.java:49)
> >>        at
> org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1518)
> >> ...
> >>
> >>
> >>                 Form<User> form =
> new Form<User>("form", new
> >> CompoundPropertyModel<User>(new
> HibernateEntityModel<User>(User.class,
> >> u.getId()))) {
> >>                        @Override
> >>                        protected void
> onSubmit() {
> >>                              
>  User u = getModelObject();
> >>
> >>                              
>  u.setPassword(DigestUtils.md5Hex(u.getPassword());
> >>                              
>  userDAO.save(u);
> >>
> >>                              
>  setRedirect(true);
> >>                              
>  setResponsePage(HubApplication.get().getHomePage());
> >>                        }
> >>
> >>                };
> >>                form.add(new
> Label("email"));
> >>                PasswordTextField password
> = new PasswordTextField("password");
> >>                form.add(password);
> >>                PasswordTextField
> repeatPassword = new PasswordTextField("repeatPassword");
> >>              
>  repeatPassword.setModel(password.getModel());
> >>                form.add(repeatPassword);
> >>
> >>                form.add(new
> EqualPasswordInputValidator(password, repeatPassword));
> >>                form.add(new
> SubmitLink("submitLink"));
> >>                add(form);
> >>
> >>
> >> This is just one example - we see elsewhere in the
> logs sometimes a
> >> textfield that is setrequired(true) ends up
> nullpointering somewhere
> >> when saving the object.
> >>
> >> What could do this?
> >>
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 


      

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Properties of model are set to NULL even though we have setRequired set to true

Posted by Wayne Pope <wa...@googlemail.com>.
Hi David,

thing is - we cannot reproduce it at all, so we cannot debug at all
and hence we don't know where to start. I suppose we could put
debugging traces in our code and the wicket code to help us understand
but that doesn't feel right..

On Tue, Apr 6, 2010 at 3:58 PM, David Chang <da...@yahoo.com> wrote:
> Hello Wayne,
>
> I understand your frustration. Recently, I got a similar case but it eventually turned out that it was my fault due to being new in Wicket. Long story short, for a dropdownchoice list with loadabledetachablemodel, I set up a load method, but in another place, I used dropdownchoice#setChoices to update the list for ajax update. This method actually changes the model, but i did not know about its impact. I spent almost a whole day to figure out why the load method did not get called again.
>
> So in your case, there MUST be a reason. Look everywhere these fields get changed.
>
> Good luck!
> David
>
>
> --- On Tue, 4/6/10, nino martinez wael <ni...@gmail.com> wrote:
>
>> From: nino martinez wael <ni...@gmail.com>
>> Subject: Re: Properties of model are set to NULL even though we have  setRequired set to true
>> To: users@wicket.apache.org
>> Date: Tuesday, April 6, 2010, 9:51 AM
>> Hi Wayne
>>
>> I guess you've tried debugging it, so it's not a consistent
>> error? Are
>> you using any special web container or is wrapped somehow
>> (like
>> terracotta)?
>>
>> 2010/4/6 Wayne Pope <wa...@googlemail.com>:
>> > Hi,
>> >
>> > has anyone got any idea about this? I'm still
>> 'spinning my wheels' on it.
>> >
>> > thanks for any help.
>> >
>> > On Fri, Apr 2, 2010 at 5:00 PM, Wayne Pope
>> > <wa...@googlemail.com>
>> wrote:
>> >> Hi,
>> >>
>> >> we've got several examples in our logs of
>> properties of the model
>> >> being set to null even though the textfield is set
>> to required.
>> >> I have NO idea how on earth this can happen - its
>> just doesn't make
>> >> sense - and its really frustrating me!!
>> >>
>> >> here's an example:
>> >>
>> >> Caused by: java.lang.NullPointerException
>> >>        at
>> org.apache.commons.codec.digest.DigestUtils.md5(DigestUtils.java:86)
>> >>        at
>> org.apache.commons.codec.digest.DigestUtils.md5Hex(DigestUtils.java:108)
>> >>        at
>> hub.app.wicket.admin.ChangePasswordPage$1.onSubmit(ChangePasswordPage.java:49)
>> >>        at
>> org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1518)
>> >> ...
>> >>
>> >>
>> >>                 Form<User> form =
>> new Form<User>("form", new
>> >> CompoundPropertyModel<User>(new
>> HibernateEntityModel<User>(User.class,
>> >> u.getId()))) {
>> >>                        @Override
>> >>                        protected void
>> onSubmit() {
>> >>
>>  User u = getModelObject();
>> >>
>> >>
>>  u.setPassword(DigestUtils.md5Hex(u.getPassword());
>> >>
>>  userDAO.save(u);
>> >>
>> >>
>>  setRedirect(true);
>> >>
>>  setResponsePage(HubApplication.get().getHomePage());
>> >>                        }
>> >>
>> >>                };
>> >>                form.add(new
>> Label("email"));
>> >>                PasswordTextField password
>> = new PasswordTextField("password");
>> >>                form.add(password);
>> >>                PasswordTextField
>> repeatPassword = new PasswordTextField("repeatPassword");
>> >>
>>  repeatPassword.setModel(password.getModel());
>> >>                form.add(repeatPassword);
>> >>
>> >>                form.add(new
>> EqualPasswordInputValidator(password, repeatPassword));
>> >>                form.add(new
>> SubmitLink("submitLink"));
>> >>                add(form);
>> >>
>> >>
>> >> This is just one example - we see elsewhere in the
>> logs sometimes a
>> >> textfield that is setrequired(true) ends up
>> nullpointering somewhere
>> >> when saving the object.
>> >>
>> >> What could do this?
>> >>
>> >
>> >
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org