Project: Birt
Bug 415915 NPE in MultiPageReportEditor.isSaveAsAllowed
Reported: 2013-08-26 16:34:41 | Status: resolved fixed

Due to getActivePageInstance() being able to return null if no page is active, isSaveAsAllowed will fail if this occurs, as it does when the whole application is closed with the close button. Here's the log: !ENTRY org.eclipse.e4.ui.workbench 4 0 2013-08-26 13:28:43.478 !MESSAGE Exception occurred while unrendering: org.eclipse.e4.ui.model.application.ui.basic.impl.TrimmedWindowImpl@123db25 (elementId: IDEWindow, tags: [topLevel], contributorURI: platform:/plugin/org.eclipse.ui.workbench) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (label: null, iconURI: null, tooltip: null, context: TrimmedWindowImpl (IDEWindow) Context, variables: [], x: -1114, y: 80, width: 1024, height: 768) !STACK 0 java.lang.NullPointerException at org.eclipse.birt.report.designer.ui.editors.MultiPageReportEditor.isSaveAsAllowed(MultiPageReportEditor.java:585) at org.eclipse.ui.internal.handlers.SaveAsHandler.evaluate(SaveAsHandler.java:64) at org.eclipse.ui.internal.handlers.AbstractSaveHandler$1.evaluate(AbstractSaveHandler.java:45) at org.eclipse.ui.internal.services.EvaluationReference.evaluate(EvaluationReference.java:94) at org.eclipse.ui.internal.services.EvaluationReference.evaluate(EvaluationReference.java:131) at org.eclipse.ui.internal.services.EvaluationReference.changed(EvaluationReference.java:125) at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:110) at org.eclipse.e4.core.internal.contexts.EclipseContext.processScheduled(EclipseContext.java:328) at org.eclipse.e4.core.internal.contexts.EclipseContext.remove(EclipseContext.java:302) at org.eclipse.ui.internal.services.EvaluationService$1.changed(EvaluationService.java:71) at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:110) at org.eclipse.e4.core.internal.contexts.EclipseContext.processScheduled(EclipseContext.java:328) at org.eclipse.e4.core.internal.contexts.EclipseContext.set(EclipseContext.java:342) at org.eclipse.e4.core.internal.contexts.EclipseContext.deactivate(EclipseContext.java:640) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.clearContext(PartRenderingEngine.java:936) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeRemoveGui(PartRenderingEngine.java:920) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$3(PartRenderingEngine.java:828) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$8.run(PartRenderingEngine.java:823) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.removeGui(PartRenderingEngine.java:808) at org.eclipse.ui.internal.WorkbenchWindow.hardClose(WorkbenchWindow.java:1598) at org.eclipse.ui.internal.WorkbenchWindow.busyClose(WorkbenchWindow.java:1231) at org.eclipse.ui.internal.WorkbenchWindow.access$14(WorkbenchWindow.java:1198) at org.eclipse.ui.internal.WorkbenchWindow$10.run(WorkbenchWindow.java:1261) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ui.internal.WorkbenchWindow.close(WorkbenchWindow.java:1259) at org.eclipse.ui.internal.Workbench$14.run(Workbench.java:1096) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.ui.internal.Workbench.busyClose(Workbench.java:1079) at org.eclipse.ui.internal.Workbench.access$19(Workbench.java:1024) at org.eclipse.ui.internal.Workbench$19.run(Workbench.java:1327) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ui.internal.Workbench.close(Workbench.java:1325) at org.eclipse.ui.internal.Workbench.close(Workbench.java:1298) at org.eclipse.ui.internal.WorkbenchWindow.busyClose(WorkbenchWindow.java:1227) at org.eclipse.ui.internal.WorkbenchWindow.access$14(WorkbenchWindow.java:1198) at org.eclipse.ui.internal.WorkbenchWindow$10.run(WorkbenchWindow.java:1261) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ui.internal.WorkbenchWindow.close(WorkbenchWindow.java:1259) at org.eclipse.ui.internal.WorkbenchWindow.close(WorkbenchWindow.java:1271) at org.eclipse.ui.internal.WorkbenchWindow$6.close(WorkbenchWindow.java:474) at org.eclipse.e4.ui.workbench.renderers.swt.WBWRenderer$12.shellClosed(WBWRenderer.java:612) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:98) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1081) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066) at org.eclipse.swt.widgets.Decorations.closeWidget(Decorations.java:309) at org.eclipse.swt.widgets.Decorations.WM_CLOSE(Decorations.java:1697) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4613) at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:340) at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1627) at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2075) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4977) at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method) at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544) at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:498) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4706) at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:340) at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1627) at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2075) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4977) at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method) at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544) at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:498) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4706) at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:340) at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1627) at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2075) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4977) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2549) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150) at org.eclipse.birt.report.designer.ui.rcp.DesignerApplication.run(DesignerApplication.java:38) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591) at org.eclipse.equinox.launcher.Main.run(Main.java:1450) at org.eclipse.equinox.launcher.Main.main(Main.java:1426)

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