Project: Birt
Bug 305851 NullPointerException in PageSetAction.update()
Reported: 2010-03-15 09:51:32 | Status: resolved fixed

Build Identifier: M20100211-1343 FormEditor.getActivePageInstance() may return null, in which case PageSetAction.update() NPEs: org.eclipse.birt.report.designer.ui.editors.actions.PageSetAction: public void update( ) { FormEditor editor = UIUtil.getActiveReportEditor( ); setEnabled( editor != null ); if ( editor != null ) { setChecked( editor.getActivePageInstance( ) NPE here ----> .getId( ) .equals( pageId ) ); } } See this stacktrace: java.lang.NullPointerException at org.eclipse.birt.report.designer.ui.editors.actions.PageSetAction.update(PageSetAction.java:48) at org.eclipse.birt.report.designer.ui.editors.actions.PageSetAction.<init>(PageSetAction.java:33) at org.eclipse.birt.report.designer.internal.ui.extension.FormPageDef.<init>(FormPageDef.java:59) at org.eclipse.birt.report.designer.internal.ui.extension.EditorContributorManager.createFormPageDefList(EditorContributorManager.java:392) at org.eclipse.birt.report.designer.internal.ui.extension.EditorContributorManager.createEditorContributor(EditorContributorManager.java:263) at org.eclipse.birt.report.designer.internal.ui.extension.EditorContributorManager.createEditorContributorMap(EditorContributorManager.java:241) at org.eclipse.birt.report.designer.internal.ui.extension.EditorContributorManager.getEditorContributor(EditorContributorManager.java:151) at org.eclipse.birt.report.designer.ui.editors.actions.MultiPageEditorActionBarContributor.createPageMenu(MultiPageEditorActionBarContributor.java:264) at org.eclipse.birt.report.designer.ui.editors.actions.MultiPageEditorActionBarContributor.contributeToMenu(MultiPageEditorActionBarContributor.java:245) at org.eclipse.ui.part.EditorActionBarContributor.init(EditorActionBarContributor.java:167) at org.eclipse.ui.part.EditorActionBarContributor.init(EditorActionBarContributor.java:146) at org.eclipse.ui.internal.EditorManager.createEditorActionBars(EditorManager.java:323) at org.eclipse.ui.internal.EditorManager.createSite(EditorManager.java:790) at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:644) at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:462) at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595) at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:286) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2857) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2762) at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2754) at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2705) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2701) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2685) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2676) at org.eclipse.ui.ide.IDE.openEditor(IDE.java:651) at org.eclipse.ui.ide.IDE.openEditor(IDE.java:610) at org.eclipse.ui.actions.OpenFileAction.openFile(OpenFileAction.java:99) at org.eclipse.ui.actions.OpenSystemEditorAction.run(OpenSystemEditorAction.java:99) at org.eclipse.ui.views.navigator.OpenActionGroup.runDefaultAction(OpenActionGroup.java:133) at org.eclipse.ui.views.navigator.MainActionGroup.runDefaultAction(MainActionGroup.java:330) at org.eclipse.ui.views.navigator.ResourceNavigator.handleOpen(ResourceNavigator.java:787) at org.eclipse.ui.views.navigator.ResourceNavigator$6.open(ResourceNavigator.java:499) at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48) at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:842) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.runtime.Platform.run(Platform.java:888) at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175) at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:840) at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1101) at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1205) at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:264) at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:258) at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:298) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3910) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3503) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405) Reproducible: Always

Files changed in fix:
UI/org.eclipse.birt.report.designer.ui.editors/src/org/eclipse/birt/report/designer/ui/editors/actions/PageSetAction.java