Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 246278 - NPE in DefaultDetailPane.java:264
Summary: NPE in DefaultDetailPane.java:264
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M3   Edit
Assignee: Curtis Windatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-04 16:12 EDT by Dan Heidinga CLA
Modified: 2008-09-24 15:10 EDT (History)
1 user (show)

See Also:


Attachments
One line patch to fix NPE (1.15 KB, patch)
2008-09-04 16:22 EDT, Dan Heidinga CLA
no flags Details | Diff
Slightly better fix then previous patch (1.25 KB, patch)
2008-09-15 11:21 EDT, Dan Heidinga CLA
curtis.windatt.public: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Heidinga CLA 2008-09-04 16:12:35 EDT
Build ID:  I20080617-2000

Steps To Reproduce:
1.  Create an IDebugModelPresentation subclass
2.  Report null in "void computeDetail(IValue value, IValueDetailListener listener);"
3.  Watch NPE occur


More information:
IDebugModelPresentation#computeDetail API contract states:
"If <code>null</code> is reported, the value's value string is displayed (<code>IValue.getValueString()</code>)."

The DefaultDetailPane never checks for a null input and doesn't replace null with #getValueString.

StackTrace:
------------
java.lang.NullPointerException
	at org.eclipse.debug.internal.ui.views.variables.details.DefaultDetailPane$1.runInUIThread(DefaultDetailPane.java:264)
	at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:94)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:133)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3800)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3425)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
	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:193)
	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:382)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:612)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
Comment 1 Dan Heidinga CLA 2008-09-04 16:22:22 EDT
Created attachment 111715 [details]
One line patch to fix NPE

Minimal patch to fix the problem.
Comment 2 Dan Heidinga CLA 2008-09-15 11:21:37 EDT
Created attachment 112551 [details]
Slightly better fix then previous patch

The original patch didn't handle the case where getVariableValue() returns null.  This one replaces the null with the string "Variable detail is null".
Comment 3 Curtis Windatt CLA 2008-09-24 15:08:16 EDT
Committed patch with minor modifications.
Comment 4 Curtis Windatt CLA 2008-09-24 15:10:50 EDT
Verified.