AW: AW: NullPointerException on submitting a form in a modal window
I found the line which set the modalWindow to null. Thanks for your help Mit freundlichen Grüßen Christoph Manig -Ursprüngliche Nachricht- Von: Manfred Bergmann [mailto:m...@software-by-mabe.com] Gesendet: Mittwoch, 22. Februar 2017 14:19 An: users@wicket.apache.org Betreff: Re: AW: NullPointerException on submitting a form in a modal window It it's that line, than only the modalWindow instance variable can be null. Can you confirm that by either adding a log line or debug into there. If it is indeed null something in the surrounding of the classes you show makes it null, or cleans it up. Some concurrency going on maybe? Manfred -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/NullPointerException-on-submitting-a-form-in-a-modal-window-tp4677161p4677167.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: NullPointerException on submitting a form in a modal window
When the RemarkForm is instancied, addButtons() is called. At this point the modalWindow is null. So the modalWindow argument given to the AddRemarkButton constructor is null. You should modify the RemarkForm constructor to something like public RemarkForm(String id, ModalWindow modalWindow) { François > Le 22 févr. 2017 à 14:19, Manfred Bergmanna > écrit : > > It it's that line, than only the modalWindow instance variable can be null. > Can you confirm that by either adding a log line or debug into there. > > If it is indeed null something in the surrounding of the classes you show > makes it null, or cleans it up. Some concurrency going on maybe? > > > Manfred > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/NullPointerException-on-submitting-a-form-in-a-modal-window-tp4677161p4677167.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AW: NullPointerException on submitting a form in a modal window
It it's that line, than only the modalWindow instance variable can be null. Can you confirm that by either adding a log line or debug into there. If it is indeed null something in the surrounding of the classes you show makes it null, or cleans it up. Some concurrency going on maybe? Manfred -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/NullPointerException-on-submitting-a-form-in-a-modal-window-tp4677161p4677167.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: NullPointerException on submitting a form in a modal window
The line which throws the exception is modalWindow.close(target); in AddRemarkButton. I do not copy the import statements so there are less lines in my copied code. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/NullPointerException-on-submitting-a-form-in-a-modal-window-tp4677161p4677166.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
AW: NullPointerException on submitting a form in a modal window
The line which throws the exception is modalWindow.close(target); in AddRemarkButton. I do not copy the import statements so there are less lines in my copied code. Mit freundlichen Grüßen Christoph Manig -Ursprüngliche Nachricht- Von: Manfred Bergmann [mailto:m...@software-by-mabe.com] Gesendet: Mittwoch, 22. Februar 2017 11:41 An: users@wicket.apache.org Betreff: Re: NullPointerException on submitting a form in a modal window Maybe not all of those classes are in separate files. Manfred -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/NullPointerException-on-submitting-a-form-in-a-modal-window-tp4677161p4677164.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: NullPointerException on submitting a form in a modal window
Maybe not all of those classes are in separate files. Manfred -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/NullPointerException-on-submitting-a-form-in-a-modal-window-tp4677161p4677164.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: NullPointerException on submitting a form in a modal window
The AddRemarkButton source code you show is not the one who generated the exception. The exception has been thrown line 32 in the submit method. The source code you show has only 22 lines Put a breakpoint in the onSubmit method. François > Le 22 févr. 2017 à 11:16, Manfred Bergmanna > écrit : > > Hi. > > What's on line 32 of AddRemarkButton.java? > > > Manfred > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/NullPointerException-on-submitting-a-form-in-a-modal-window-tp4677161p4677162.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: NullPointerException on submitting a form in a modal window
Hi. What's on line 32 of AddRemarkButton.java? Manfred -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/NullPointerException-on-submitting-a-form-in-a-modal-window-tp4677161p4677162.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
NullPointerException on submitting a form in a modal window
Hello, I have a page which contains a table form. Inside this table there are some message objects and their data shown. Moreover the user can select some of the messages and trigger some action on them. Then there should be a modal window where the user have to set a remark for the selected messages. The modal window: public class RemarkModalWindow extends ModalWindow{ /** serialVersionUID */ private static final long serialVersionUID = 8798141972520682460L; /** * Constructor for the modal window. * * @param id the id of the modal window */ public RemarkModalWindow(String id) { super(id); RemarkPanel remarkPanel = new RemarkPanel(this.getContentId(), this); this.setContent(remarkPanel); this.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() { /** serialVersionUID */ private static final long serialVersionUID = 4018212161671004354L; @Override public boolean onCloseButtonClicked(AjaxRequestTarget target) { DAPForm remarkForm = remarkPanel.getRemarkForm(); remarkForm.error(getString("remarkModalClose.errorMessage")); target.add(remarkForm); return false; } }); } @Override public boolean isResizable(){ return false; } @Override public int getInitialWidth(){ return 500; } @Override public int getInitialHeight(){ return 100; } @Override public IModel getTitle(){ return Model.of(getString("remarkModal.title")); } } So I created a modal window which contains a panel. Inside the panel there is a form with the textfield for the remark and an "add" button. If I click the "add" button the window should be closed and the message objects should get the remark. The panel inside the modal window: public class RemarkPanel extends Panel { /** serialVersionUID */ private static final long serialVersionUID = -8422969117822175332L; RemarkForm remarkForm; /** * Constructor which creates the panel. * * @param id the id of the panel * @param remarkModalWindow */ public RemarkPanel(String id, RemarkModalWindow remarkModalWindow) { super(id); remarkForm = (RemarkForm)FormFactory.getForm(DAPType.REMARK); remarkForm.setModalWindow(remarkModalWindow); add(remarkForm); } public DAPForm getRemarkForm() { return (DAPForm) this.remarkForm; } } The Form inside the panel: public class RemarkForm extends DAPForm { /** serialVersionUID */ private static final long serialVersionUID = -3714702420141947828L; private ModalWindow modalWindow; /** * Constructor which creates a form to set the remark of a fault message. * * @param id the id of the form */ public RemarkForm(String id) { super(id); setDefaultModel(new CompoundPropertyModel(new FaultModel())); addTextfields(); addButtons(); } /** * Adds the additional textfields. */ private void addTextfields() { TextField faultRemark = new TextField<>("faultRemark"); add(faultRemark); } /** * Adds the buttons to the form. */ private void addButtons() { add(new AddRemarkButton("addRemarkButton", this, modalWindow)); } public void setModalWindow(ModalWindow modalWindow) { this.modalWindow = modalWindow; } } This is my "add" button: public class AddRemarkButton extends AjaxButton { /** serialVersionUID */ private static final long serialVersionUID = -8702103017249783842L; private ModalWindow modalWindow; public AddRemarkButton(String id, Form form, ModalWindow modalWindow) { super(id, form); this.modalWindow = modalWindow; } @Override protected void onSubmit(AjaxRequestTarget target, Form form) { FaultModel faultModel = (FaultModel)form.getModelObject(); String remark = faultModel.getFaultRemark(); System.out.println("Remark: " + remark); modalWindow.close(target); } } If I click the "add" button in the modal window I get the following exception: java.lang.NullPointerException at com.tsystems.dap.console.components.button.AddRemarkButton.onSubmit(AddRemarkButton.java:32) at