Project: Birt
Bug 190959 NPE throws out when delete dimension[1102]
Reported: 2007-06-05 02:01:50 | Status: closed fixed

Description: There is a crosstab in the layout (one row dimension, one measure). Select the dimension and try to pull it to the column area, it does not work. Then use context menu to delete it, NPE throws out. Build Version:2.2.0.v20070605-0630 Steps to reproduce: 1. Create a sample datasource and dataset. 2. Create a cube, one dimension, one measure. 3. Create a crosstab in the layout, pull the dimension to the row area. 4. Select the dimension in the crosstab, and pull to column area, it does not work. 5. Try to delete the dimension using context menu, NPE throws out. 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:76) at org.eclipse.birt.report.designer.internal.ui.util.ExceptionHandler.handle(ExceptionHandler.java:135) at org.eclipse.birt.report.designer.internal.ui.util.ExceptionHandler.handle(ExceptionHandler.java:117) at org.eclipse.birt.report.designer.internal.ui.editors.parts.event.ModelEventManager.postModelEvent(ModelEventManager.java:132) at org.eclipse.birt.report.designer.internal.ui.editors.parts.event.ModelEventManager.postEvent(ModelEventManager.java:101) at org.eclipse.birt.report.designer.internal.ui.editors.parts.event.ModelEventManager.access$0(ModelEventManager.java:93) at org.eclipse.birt.report.designer.internal.ui.editors.parts.event.ModelEventManager$1.stackChanged(ModelEventManager.java:61) at org.eclipse.birt.report.model.activity.ActivityStack.sendNotifcations(ActivityStack.java:867) at org.eclipse.birt.report.model.activity.ActivityStack.commit(ActivityStack.java:741) at org.eclipse.birt.report.designer.internal.ui.command.WrapperCommandStack.execute(WrapperCommandStack.java:87) at org.eclipse.gef.ui.actions.WorkbenchPartAction.execute(WorkbenchPartAction.java:76) at org.eclipse.gef.ui.actions.DeleteAction.run(DeleteAction.java:125) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:545) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:504) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443) at org.eclipse.equinox.launcher.Main.run(Main.java:1169) Caused by: java.lang.NullPointerException at org.eclipse.birt.report.item.crosstab.internal.ui.editors.model.NormalCrosstabCellAdapter.hashCode(NormalCrosstabCellAdapter.java:45) at java.util.HashMap.hash(HashMap.java:264) at java.util.HashMap.get(HashMap.java:320) at org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(AbstractEditPart.java:720) at org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.ReportElementEditPart.refreshChildren(ReportElementEditPart.java:547) at org.eclipse.birt.report.item.crosstab.internal.ui.editors.editparts.CrosstabTableEditPart.refreshChildren(CrosstabTableEditPart.java:766) at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:677) at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:564) at org.eclipse.birt.report.item.crosstab.internal.ui.editors.editparts.CrosstabTableEditPart.refresh(CrosstabTableEditPart.java:816) at org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.ReportElementEditPart.contentChange(ReportElementEditPart.java:901) at org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.AbstractReportEditPart.contentChange(AbstractReportEditPart.java:220) at org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.AbstractReportEditPart$1.runModelChange(AbstractReportEditPart.java:71) at org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.AbstractReportEditPart$EditpartReportEventRunnable.run(AbstractReportEditPart.java:239) 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:197) at org.eclipse.birt.report.designer.internal.ui.editors.parts.event.ModelEventManager.postModelEvent(ModelEventManager.java:127) ... 36 more

Files changed in fix:
UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/core/commands/DeleteCommand.java xtab/org.eclipse.birt.report.item.crosstab.ui/src/org/eclipse/birt/report/item/crosstab/internal/ui/editors/editparts/CrosstabFirstCellEditPart.java