Bug 185775

Summary: NullPointerException in MapView
Product: z_Archived Reporter: John Thomas <jthomas119>
Component: OHFAssignee: Daniel Ford <webdaford>
Status: CLOSED FIXED QA Contact: Daniel Ford <webdaford>
Severity: normal    
Priority: P2 Keywords: ui
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description John Thomas CLA 2007-05-07 10:53:13 EDT
You get an exception in MapView when 2 simulations are stopped together.
To reproduce the problem, start STEM and then start 2 simulations (I used Japan just because it is small and quick to start) Then use the Stop button on the toolbar within SimulationControl (it stops both simulations).  You should see the exception.  

!ENTRY org.eclipse.ui 4 0 2007-05-07 07:27:31.509
!MESSAGE Unhandled event loop exception
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException)
	at org.eclipse.swt.SWT.error(SWT.java:3547)
	at org.eclipse.swt.SWT.error(SWT.java:3465)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:126)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3650)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3287)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2365)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2329)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2204)
	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.ohf.stem.core.common.presentation.CoreEditorAdvisor$Application.start(CoreEditorAdvisor.java:111)
	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:497)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
Caused by: java.lang.NullPointerException
	at org.eclipse.ohf.stem.ui.views.map.MapView.removeFromDisplayedSimulationSet(MapView.java:248)
	at org.eclipse.ohf.stem.ui.views.map.MapView.simulationsChanged(MapView.java:206)
	at org.eclipse.ohf.stem.jobs.simulation.SimulationManager$4.run(SimulationManager.java:365)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)
	... 23 more
Comment 1 Daniel Ford CLA 2007-07-23 14:53:56 EDT
The problem was that the MapControl was comparing the simulation it was displaying with the ones being stopped.  When it found a match it set its current simulation to null, but then on the next iteration it compared that "null" with the next simulation being deleted.  Added a test for a null Simulation before the comparison.
Comment 2 Daniel Ford CLA 2007-07-23 14:56:37 EDT
committed