Bug 185775 - NullPointerException in MapView
Summary: NullPointerException in MapView
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: OHF (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Daniel Ford CLA
QA Contact: Daniel Ford CLA
URL:
Whiteboard:
Keywords: ui
Depends on:
Blocks:
 
Reported: 2007-05-07 10:53 EDT by John Thomas CLA
Modified: 2012-01-05 13:30 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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