[ 
https://issues.apache.org/jira/browse/WICKET-2330?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Igor Vaynberg resolved WICKET-2330.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.4-RC6
         Assignee: Igor Vaynberg

> AjaxFormSubmitBehavior throws an NullPointerException when getForm() is 
> overridden
> ----------------------------------------------------------------------------------
>
>                 Key: WICKET-2330
>                 URL: https://issues.apache.org/jira/browse/WICKET-2330
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 1.4-RC4
>            Reporter: Zoltan Luspai
>            Assignee: Igor Vaynberg
>             Fix For: 1.4-RC6
>
>
> I have an AjaxFormSubmitBehavior where I don't pass the form parameter in the 
> constructor, but have overridden the getForm() method to find the related 
> form. (The form is not parent of the button this behavior is attached to, so 
> can not be found by the behavior itself).
> When I "click" on the button attached, the form is submitted nicely, but 
> after the onSubmit call I get this exception:
> java.lang.NullPointerException
>    at 
> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:142)
>    at 
> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166)
>    at 
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299)
>    at 
> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:113)
>    at 
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
>    at 
> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1240)
>    at org.apache.wicket.RequestCycle.step(RequestCycle.java:1319)
> Having a look at the source it seems there is a but at this line in 
> AjaxFormSubmitBehavior:
>    @Override
>    protected void onEvent(AjaxRequestTarget target)
>    {
>        ...
>        if (form.findParent(Page.class) != null)
>        ...
>    }
> I think that should be :
>    ... getForm().findParent(Page.class)
> unless, there is a good reason not to be so?
> Btw; I am using wicket version 1.4rc4. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to