Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325261 - [Wizards] NullPointerException in WizardDialog.updateButtons
Summary: [Wizards] NullPointerException in WizardDialog.updateButtons
Status: RESOLVED INVALID
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: All Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact: Prakash Rangaraj CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-14 10:28 EDT by Adriaan Peeters CLA
Modified: 2010-09-29 02:21 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adriaan Peeters CLA 2010-09-14 10:28:54 EDT
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
Comment 1 Prakash Rangaraj CLA 2010-09-17 01:27:24 EDT
Do you have a stack trace? I was wondering how is updateButtons() get called without the current page set
Comment 2 Adriaan Peeters CLA 2010-09-23 04:16:40 EDT
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.
Comment 3 Adriaan Peeters CLA 2010-09-23 04:22:17 EDT
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)
Comment 4 Prakash Rangaraj CLA 2010-09-29 02:21:52 EDT
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