Project: Birt
Bug 267156 Deleting should be disabled when all masterpages are selected in outline otherwise it leads NPE
Reported: 2009-03-05 03:50:01 | Status: closed fixed

Description: NPE occurs when deleting default master page and customer master page in Outline Build number: 2.5.0.v20090305-0630 Steps to reproduce: 1, Go to report outline 2, Insert a master page 3, Select the default master page and new added master page 4, Right click and delete Expected result: The delete button should be disabled if all master pages are selected. Because we must keep at least one master page. Actual result: The deleting leads NPE Error log: org.eclipse.birt.report.designer.core.runtime.GUIException: Caused by java.lang.NullPointerException. at org.eclipse.birt.report.designer.core.runtime.GUIException.createGUIException(GUIException.java:78) at org.eclipse.birt.report.designer.internal.ui.util.ExceptionHandler.handle(ExceptionHandler.java:169) at org.eclipse.birt.report.designer.internal.ui.util.ExceptionHandler.handle(ExceptionHandler.java:150) at org.eclipse.birt.report.designer.internal.ui.util.ExceptionHandler.handle(ExceptionHandler.java:89) at org.eclipse.birt.report.designer.internal.ui.editors.parts.event.ModelEventManager.postModelEvent(ModelEventManager.java:128) at org.eclipse.birt.report.designer.internal.ui.editors.parts.event.ModelEventManager.postEvent(ModelEventManager.java:97) at org.eclipse.birt.report.designer.internal.ui.editors.parts.event.ModelEventManager.access$0(ModelEventManager.java:89) at org.eclipse.birt.report.designer.internal.ui.editors.parts.event.ModelEventManager$1.stackChanged(ModelEventManager.java:57) at org.eclipse.birt.report.model.activity.ActivityStack.sendNotifcations(ActivityStack.java:853) at org.eclipse.birt.report.model.activity.ActivityStack.commit(ActivityStack.java:723) at org.eclipse.birt.report.designer.internal.ui.views.actions.AbstractElementAction.run(AbstractElementAction.java:74) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:412) 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:3875) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3470) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2388) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2352) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2204) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:499) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:333) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:492) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194) 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:368) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:556) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:511) at org.eclipse.equinox.launcher.Main.run(Main.java:1270) Caused by: java.lang.NullPointerException at org.eclipse.birt.report.designer.core.model.ReportDesignHandleAdapter.getMasterPageSize(ReportDesignHandleAdapter.java:199) at org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.ReportElementEditPart.getMasterPageSize(ReportElementEditPart.java:807) at org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.ReportDesignEditPart.refreshFigure(ReportDesignEditPart.java:156) at org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.ReportElementEditPart.refreshVisuals(ReportElementEditPart.java:498) at org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.ReportElementEditPart.propertyChange(ReportElementEditPart.java:891) at org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.ReportDesignEditPart.propertyChange(ReportDesignEditPart.java:268) at org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.AbstractReportEditPart.propertyChange(AbstractReportEditPart.java:129) at org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.AbstractReportEditPart$2.runModelChange(AbstractReportEditPart.java:92) at org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.AbstractReportEditPart$EditpartReportEventRunnable.run(AbstractReportEditPart.java:247) at org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.AbstractModelEventProcessor.postElementEvent(AbstractModelEventProcessor.java:95) at org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.GraphicsViewModelEventProcessor.postElementEvent(GraphicsViewModelEventProcessor.java:216) at org.eclipse.birt.report.designer.internal.ui.editors.parts.event.ModelEventManager.postModelEvent(ModelEventManager.java:123) ... 34 more

Files changed in fix:
UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/core/commands/DeleteCommand.java