Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 323993

Summary: Selecting TypeHierarchy on HtmlElement throws an NPE
Product: [WebTools] JSDT Reporter: Scott Kellicker <s.kellicker>
Component: GeneralAssignee: Scott Kellicker <s.kellicker>
Status: RESOLVED FIXED QA Contact: Nitin Dahyabhai <thatnitind>
Severity: normal    
Priority: P3 CC: cmjaun
Version: unspecifiedFlags: cmjaun: review+
Target Milestone: 3.2.3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 327162    
Attachments:
Description Flags
proposed patch cmjaun: iplog+

Description Scott Kellicker CLA 2010-08-30 12:25:28 EDT
Build Identifier: Helios release of JSDT as well as latest source 8/30/10

If I try to show the type hierarchy of the HTMLElement, I throw an NPE:

java.lang.NullPointerException
	at org.eclipse.jface.viewers.CustomHashtable.hashCode(CustomHashtable.java:264)
	at org.eclipse.jface.viewers.CustomHashtable.get(CustomHashtable.java:236)
	at org.eclipse.jface.viewers.StructuredViewer.mapElement(StructuredViewer.java:1295)
	at org.eclipse.jface.viewers.TreeViewer.mapElement(TreeViewer.java:760)
	at org.eclipse.wst.jsdt.internal.ui.viewsupport.ProblemTreeViewer.mapElement(ProblemTreeViewer.java:81)
	at org.eclipse.jface.viewers.StructuredViewer.associate(StructuredViewer.java:621)
	at org.eclipse.jface.viewers.AbstractTreeViewer.associate(AbstractTreeViewer.java:703)
	at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:1003)
	at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run(StructuredViewer.java:481)

Reproducible: Always

Steps to Reproduce:
1. In a javascript project, open Js Resources/ECMA 3 Browser support
2. double click on HtmlElement
3. In editor select HtmlElement and hit F4 to open type hierarchy.
4. If prompted, choose the one with the C next to it.
5. Once the type hierarchy is shown, click on "Show the Supertype Hierachy", a dialog pops up stating an NPE occurred.
Comment 1 Scott Kellicker CLA 2010-08-31 22:16:42 EDT
Created attachment 177906 [details]
proposed patch
Comment 2 Scott Kellicker CLA 2010-08-31 22:19:33 EDT
Proposed patch.

The NPE was caused when the SuperTypeHierarchyViewer tried to get the supertype of 'Object'.  The super type was correctly returned as null, however getTypesInHierarchy() added the null as an element in the results list.

Accessing this later on gave a NPE.
Comment 3 Chris Jaun CLA 2010-09-15 17:24:38 EDT
Patch looks good.
Comment 4 Scott Kellicker CLA 2010-09-15 19:29:32 EDT
Noticed the bug has been assigned back to me.  What would you like me to do to help?
Comment 5 Chris Jaun CLA 2010-09-16 09:44:10 EDT
You don't have to do anything, its standard procedure to assign the bug to the patch submitter.
Comment 6 Nitin Dahyabhai CLA 2010-09-28 17:37:46 EDT
Applied to HEAD and maintenance, thanks, Scott!