Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 273012 - [Forms] NPE in FormPage.setActive(...)
Summary: [Forms] NPE in FormPage.setActive(...)
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: User Assistance (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.5 M7   Edit
Assignee: platform-ua-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-21 00:21 EDT by Deepak Azad CLA
Modified: 2009-04-21 12:06 EDT (History)
4 users (show)

See Also:


Attachments
Proposed patch to ffix the bug by adding a null check (690 bytes, text/plain)
2009-04-21 00:24 EDT, Deepak Azad CLA
cgold: iplog+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Deepak Azad CLA 2009-04-21 00:21:03 EDT
Build ID: I20090414-0800

Steps To Reproduce:
Referring from bug 183000.
- create new Plug-in project using the "Hello, World" template
- go to plugin.xml page and insert a '=' character at the beginning
- save

- in the Package Explorer, doubleclick MANIFEST.MF
=> Dialog "The source page has errors. Other pages cannot be used until these
errors are corrected.". This is unexpected, since I just wanted to edit another
source page.

- click OK
=> Editor changes to Overview page and shows same error dialog again. Should
bug me at most once and should not kid me by showing and hiding another page.

- click OK
=> Editor switches back to plugin.xml page

- doubleclick build.properties
=> Error dialog again, followed by NPE below.


java.lang.NullPointerException
at org.eclipse.ui.forms.editor.FormPage.setActive(FormPage.java:124)
at org.eclipse.ui.forms.editor.FormEditor.setActivePage(FormEditor.java:621)
at org.eclipse.ui.forms.editor.FormEditor.setActivePage(FormEditor.java:525)
at
org.eclipse.pde.internal.ui.editor.PDEFormEditor.setActivePage(PDEFormEditor.java:758)
at
org.eclipse.pde.internal.ui.editor.plugin.ManifestEditor.showEditorInput(ManifestEditor.java:657)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2648)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2592)
at org.eclipse.ui.internal.WorkbenchPage.access$12(WorkbenchPage.java:2584)
at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2569)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2564)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2548)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2539)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:644)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:603)
at
org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:285)
at
org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:138)
at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:194)
at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:175)


More information:
Cause of Exception is an unchecked function call

public void setActive(boolean active) {
		if (active) {
			// We are switching to this page - refresh it
			// if needed.

			mform.refresh();
		}
	}

mform should be checked for null before calling refresh. The same check is done in other methods of FormPage class
Comment 1 Deepak Azad CLA 2009-04-21 00:24:32 EDT
Created attachment 132542 [details]
Proposed patch to ffix the bug by adding a null check
Comment 2 Chris Goldthorpe CLA 2009-04-21 12:06:41 EDT
The patch is good and has been applied to HEAD.