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

Bug 361005

Summary: NPE in Attributes Tab of Web Page Editor Properties
Product: [WebTools] Java Server Faces Reporter: Werner Keil <werner.keil>
Component: UIAssignee: Ian Trimble <ian.trimble>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: achima123, raghunathan.srinivasan, vrubezhny
Version: 3.3.1   
Target Milestone: 3.4.0 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
The patch prevents NullPointerException in org.eclipse.jst.jsf.facelet.core.internal.cm.ElementCMAdapter.getLength() method call raghunathan.srinivasan: iplog+

Description Werner Keil CLA 2011-10-14 12:32:37 EDT
When editing a XHTML file in Web Page Editor, trying to view or update attributes in the Properties view fails with a NullPointerException.

This problem consistently occurs in WTP of the Indigo GA version and the latest Juno M2 release for Java EE.

It also happens with every Java 6 release tested between 1.6.0_01 and 1.6.0_27.


Stacktrace:
eclipse.buildId=I20110916-1615
java.version=1.6.0_01
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.jee.product

Error
Fri Oct 14 18:25:34 CEST 2011
Unexpected runtime error while computing a text hover

java.lang.NullPointerException
	at org.eclipse.jst.jsf.facelet.core.internal.cm.ElementCMAdapter.getLength(ElementCMAdapter.java:109)
	at org.eclipse.wst.xml.core.internal.contentmodel.basic.CMNamedNodeMapImpl.<init>(CMNamedNodeMapImpl.java:40)
	at org.eclipse.wst.xml.ui.internal.taginfo.XMLTagInfoHoverProcessor.getCMAttributeDeclaration(XMLTagInfoHoverProcessor.java:206)
	at org.eclipse.wst.xml.ui.internal.taginfo.XMLTagInfoHoverProcessor.computeTagAttNameHelp(XMLTagInfoHoverProcessor.java:122)
	at org.eclipse.wst.xml.ui.internal.taginfo.XMLTagInfoHoverProcessor.computeRegionHelp(XMLTagInfoHoverProcessor.java:108)
	at org.eclipse.wst.xml.ui.internal.taginfo.XMLTagInfoHoverProcessor.computeHoverHelp(XMLTagInfoHoverProcessor.java:86)
	at org.eclipse.wst.xml.ui.internal.taginfo.XMLTagInfoHoverProcessor.getHoverInfo(XMLTagInfoHoverProcessor.java:257)
	at org.eclipse.jst.jsf.facelet.ui.internal.hover.FaceletHover.getHoverInfo(FaceletHover.java:58)
	at org.eclipse.wst.sse.ui.internal.taginfo.BestMatchHover.getHoverInfo(BestMatchHover.java:108)
	at org.eclipse.jface.text.TextViewerHoverManager$4.run(TextViewerHoverManager.java:168)
Comment 1 Nitin Dahyabhai CLA 2011-10-14 12:48:14 EDT
I doubt ElementCMAdapter#getLength() should ever throw a NPE.
Comment 2 Victor Rubezhny CLA 2011-10-17 13:07:07 EDT
(In reply to comment #1)
> I doubt ElementCMAdapter#getLength() should ever throw a NPE.

The reason of this NullPointerException is org.eclipse.jst.jsf.facelet.core.internal.cm.FaceletDocumentFactory.createExternalTagInfo(String) method returning null in case of JSFVersion cannot be calculated on a faceted project. But IMO this method should return new MetadataTagInfo(_project, uri) rather than just null.
Comment 3 Victor Rubezhny CLA 2011-10-17 13:15:06 EDT
Created attachment 205355 [details]
The patch prevents NullPointerException in org.eclipse.jst.jsf.facelet.core.internal.cm.ElementCMAdapter.getLength() method call

The patch prevents NullPointerException in org.eclipse.jst.jsf.facelet.core.internal.cm.ElementCMAdapter.getLength() method call by returning TagInfo regardless of JSFVersion determination result.
In case of JSF Version couldn't be determined on faceted project it returns a new MetadataTagInfo object as TagInfo.
Comment 4 Raghunathan Srinivasan CLA 2011-10-17 13:34:08 EDT
Thanks for the patch. We will review.
Comment 5 Ian Trimble CLA 2012-01-06 14:01:15 EST
Fix committed to HEAD at 2012/01/06 11:01AM PST.