Updated Branches: refs/heads/wicket-1.5.x ce3c4a9c6 -> fb6330bc4
WICKET-5158 Ignore missing Page in StatelessForm#process() Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/fb6330bc Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/fb6330bc Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/fb6330bc Branch: refs/heads/wicket-1.5.x Commit: fb6330bc4cb1a592acad616127474dd0b6f8dfef Parents: ce3c4a9 Author: Martin Tzvetanov Grigorov <mgrigo...@apache.org> Authored: Fri Apr 26 14:29:07 2013 +0200 Committer: Martin Tzvetanov Grigorov <mgrigo...@apache.org> Committed: Fri Apr 26 14:29:07 2013 +0200 ---------------------------------------------------------------------- .../wicket/markup/html/form/StatelessForm.java | 28 +++++++++------ 1 files changed, 17 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/fb6330bc/wicket-core/src/main/java/org/apache/wicket/markup/html/form/StatelessForm.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/StatelessForm.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/StatelessForm.java index 2442556..f8f7f99 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/StatelessForm.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/StatelessForm.java @@ -16,6 +16,7 @@ */ package org.apache.wicket.markup.html.form; +import org.apache.wicket.Page; import org.apache.wicket.model.IModel; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.util.visit.IVisit; @@ -86,21 +87,26 @@ public class StatelessForm<T> extends Form<T> { super.process(submittingComponent); - final PageParameters parameters = getPage().getPageParameters(); - if (parameters != null) + Page page = findPage(); + // the application may have removed this form from its parent in #onSubmit() + if (page != null) { - visitFormComponents(new IVisitor<FormComponent<?>, Void>() + final PageParameters parameters = page.getPageParameters(); + if (parameters != null) { - public void component(final FormComponent<?> formComponent, final IVisit<Void> visit) + visitFormComponents(new IVisitor<FormComponent<?>, Void>() { - parameters.remove(formComponent.getInputName()); + public void component(final FormComponent<?> formComponent, final IVisit<Void> visit) + { + parameters.remove(formComponent.getInputName()); + } + }); + parameters.remove(getHiddenFieldId()); + if (submittingComponent instanceof AbstractSubmitLink) + { + AbstractSubmitLink submitLink = (AbstractSubmitLink)submittingComponent; + parameters.remove(submitLink.getInputName()); } - }); - parameters.remove(getHiddenFieldId()); - if (submittingComponent instanceof AbstractSubmitLink) - { - AbstractSubmitLink submitLink = (AbstractSubmitLink)submittingComponent; - parameters.remove(submitLink.getInputName()); } } }