Bug 33834 - [Viewers] NPE in TreeViewer
Summary: [Viewers] NPE in TreeViewer
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows XP
: P1 blocker (vote)
Target Milestone: 2.1 RC2   Edit
Assignee: Christophe Cornu CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-05 09:26 EST by Dirk Baeumer CLA
Modified: 2003-03-07 15:37 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Baeumer CLA 2003-03-05 09:26:48 EST
I20030304

I get the following NPE when debugging using the latest integration build. It 
mostly happens when clicking on an entry in the vaiable view. This is really 
annoying since you have to shutdown eclipse when it happens.

java.lang.NullPointerException
	at org.eclipse.jface.viewers.TreeViewer.getExpanded
(TreeViewer.java:127)
	at org.eclipse.jface.viewers.AbstractTreeViewer.internalCollectExpanded
(AbstractTreeViewer.java:764)
	at org.eclipse.jface.viewers.AbstractTreeViewer.getExpandedElements
(AbstractTreeViewer.java:527)
	at org.eclipse.debug.internal.ui.views.ViewerState.saveState
(ViewerState.java:38)
	at org.eclipse.debug.internal.ui.views.ViewerState.<init>
(ViewerState.java:28)
	at 
org.eclipse.debug.internal.ui.views.variables.VariablesView.setViewerInput
(VariablesView.java:350)
	at 
org.eclipse.debug.internal.ui.views.variables.VariablesView.selectionChanged
(VariablesView.java:1090)
	at org.eclipse.ui.internal.AbstractPartSelectionTracker$1.run
(AbstractPartSelectionTracker.java:105)
	at org.eclipse.core.internal.runtime.InternalPlatform.run
(InternalPlatform.java:867)
	at org.eclipse.core.runtime.Platform.run(Platform.java:413)
	at org.eclipse.ui.internal.AbstractPartSelectionTracker.fireSelection
(AbstractPartSelectionTracker.java:103)
	at org.eclipse.ui.internal.PagePartSelectionTracker$1.selectionChanged
(PagePartSelectionTracker.java:32)
	at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:153)
	at org.eclipse.core.internal.runtime.InternalPlatform.run
(InternalPlatform.java:867)
	at org.eclipse.core.runtime.Platform.run(Platform.java:413)
	at org.eclipse.jface.viewers.Viewer.fireSelectionChanged
(Viewer.java:151)
	at org.eclipse.jface.viewers.StructuredViewer.updateSelection
(StructuredViewer.java:1287)
	at org.eclipse.jface.viewers.StructuredViewer.handleSelect
(StructuredViewer.java:654)
	at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected
(StructuredViewer.java:678)
	at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent
(OpenStrategy.java:172)
	at org.eclipse.jface.util.OpenStrategy.access$3(OpenStrategy.java:167)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent
(OpenStrategy.java:302)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1268)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:1251)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:845)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461)
	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:324)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:247)
	at org.eclipse.core.launcher.Main.run(Main.java:703)
	at org.eclipse.core.launcher.Main.main(Main.java:539)
Comment 1 Nick Edgar CLA 2003-03-05 21:55:14 EST
I don't see how this can happen, since 
AbstractTreeViewer.internalCollectExpanded just iterates over the items 
obtained from SWT, passing some of them to getExpanded.
Unless Tree.getItems() gets a null in it.

I'm wondering if it's a JIT bug.  We've seen one recently on IBM 1.3.1 SR2, 
which was causing an NPE in the Tasks view (this happened in SR1 as well, but 
apparently more frequently in SR2).  Which VM are you using, and have you 
recently changed?
Comment 2 Nick Edgar CLA 2003-03-05 22:13:49 EST
Actually, the presence of line numbers in the stack trace suggests it's not a 
JIT problem.

Christophe, do you think this could be caused by bug 32734?  I guess not since 
the stacks appear different, and 32734 was fixed for I20030304.

Dirk, a reproduceable case here would really help.
Comment 3 Dirk Baeumer CLA 2003-03-06 03:57:41 EST
The VM I am using

java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
Comment 4 Christophe Cornu CLA 2003-03-07 09:53:13 EST
Not a duplicate of bug 32734 - which causes a NPE inside SWT
It would be really interesting to have a reproduceable case and verify 
Tree.getItems return a null element.
Comment 5 Christophe Cornu CLA 2003-03-07 10:04:33 EST
This could be a variant of bug 4434. Bug 4434 causes an internal call to SWT 
Tree.getItems to return an array with a null item.
Comment 6 Nick Edgar CLA 2003-03-07 10:18:46 EST
Veronika mentioned that SWT has fixed a similar problem in the variables view.
This was in the variables view too.
Comment 7 Veronika Irvine CLA 2003-03-07 13:32:00 EST
Fixed.  Not in time for RC2.
Comment 8 Christophe Cornu CLA 2003-03-07 15:37:17 EST
Fix available in version > v20030307
We have released a fix for a similar problem (bug 4434). It should also fix this 
problem.

Dirk, please reopen if you can reproduce with version > v20030307.