Community
Participate
Working Groups
Build Identifier: 20100617-1415 When WizardDialog.updateButtons is called without a current page, a NullPointerException is thrown. updateButtons should, similar to updateMessage, start with a null check of the currentPage variable. Reproducible: Always
Do you have a stack trace? I was wondering how is updateButtons() get called without the current page set
I do not have a concrete stack trace but I encountered this 'bug' in the following scenario. I have a wizard that updates its buttons on changes in the underlying data model (using a listener). This data model might change before the wizard is open, hence triggering the listener which calls updateButtons. In this method currentPage is referenced, which is null.
A simplified stack trace follows: java.lang.NullPointerException at org.eclipse.jface.wizard.WizardDialog.updateButtons(WizardDialog.java:1326) ... updateButtons is called somehow during createControl ... at com.example.WizardPage.createControl(WizardPage.java:32) at org.eclipse.jface.wizard.Wizard.createPageControls(Wizard.java:170) at org.eclipse.jface.wizard.WizardDialog.createPageControls(WizardDialog.java:734) at org.eclipse.jface.wizard.WizardDialog.createContents(WizardDialog.java:606) at org.eclipse.jface.window.Window.create(Window.java:431) at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1089) at org.eclipse.jface.window.Window.open(Window.java:790)
The updateButtons() sets the enablement of the back/next buttons. You cannot do this before the creation of all the wizard pages. So calling the updateButtons() in the wizardPage.createControl() method is not correct. You can probably move the logic to the setVisible() method