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

Bug 352079

Summary: NPE thrown when opening a DTD file with the 'XPath' view open
Product: [WebTools] WTP Source Editing Reporter: Remy Suen <remy.suen>
Component: wst.xpathAssignee: Project Inbox <wst.xsl-inbox>
Status: NEW --- QA Contact: Jesper Moller <jesper>
Severity: normal    
Priority: P3 CC: d_a_carver, pwebster
Version: 3.3   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Remy Suen CLA 2011-07-14 09:14:00 EDT
Build: eclipse-jee-indigo-win32

1. Open the 'XPath' view.
2. Create a DTD file.
3. An exception will occur after the editor opens.

java.lang.NullPointerException
	at org.eclipse.wst.xml.xpath.ui.internal.XPathUIPlugin.getNamespaceInfo(XPathUIPlugin.java:153)
	at org.eclipse.wst.xml.xpath.ui.internal.views.XPathComputer.updateNamespaces(XPathComputer.java:217)
	at org.eclipse.wst.xml.xpath.ui.internal.views.XPathComputer.updateExpression(XPathComputer.java:123)
	at org.eclipse.wst.xml.xpath.ui.internal.views.XPathComputer.setText(XPathComputer.java:146)
	at org.eclipse.wst.xml.xpath.ui.internal.views.XPathView.recomputeXPath(XPathView.java:293)
	at org.eclipse.wst.xml.xpath.ui.internal.views.XPathView.editorActivated(XPathView.java:378)
	at org.eclipse.wst.xml.xpath.ui.internal.views.XPathView.access$5(XPathView.java:368)
	at org.eclipse.wst.xml.xpath.ui.internal.views.XPathView$XPathPartListener.partActivated(XPathView.java:464)
	at org.eclipse.ui.internal.PartListenerList2$1.run(PartListenerList2.java:70)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.runtime.Platform.run(Platform.java:888)
	at org.eclipse.ui.internal.PartListenerList2.fireEvent(PartListenerList2.java:55)
	at org.eclipse.ui.internal.PartListenerList2.firePartActivated(PartListenerList2.java:68)
	at org.eclipse.ui.internal.PartService.firePartActivated(PartService.java:192)
	at org.eclipse.ui.internal.PartService.setActivePart(PartService.java:306)
	at org.eclipse.ui.internal.WorkbenchPagePartList.fireActivePartChanged(WorkbenchPagePartList.java:57)
	at org.eclipse.ui.internal.PartList.setActivePart(PartList.java:136)
	at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:3636)
	at org.eclipse.ui.internal.WorkbenchPage.internalActivate(WorkbenchPage.java:691)
	at org.eclipse.ui.internal.WorkbenchPage.activate(WorkbenchPage.java:663)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2957)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2850)
	at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2842)
	at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2793)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2789)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2773)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2764)
Comment 1 David Carver CLA 2011-07-14 09:31:15 EDT
Suspect we need to check the content type, or set up a finer filter for which editors this view can be used with.  Right now it is being enabled for all Structured Editors which it probably shouldn't be doing.
Comment 2 Remy Suen CLA 2011-07-14 13:41:17 EDT
The inverse is also a problem where you have an "invalid" file opened and then you try to open the 'XPath' view. The view will not get constructed.

java.lang.NullPointerException
	at org.eclipse.wst.xml.xpath.ui.internal.views.XPathComputer.updateExpression(XPathComputer.java:122)
	at org.eclipse.wst.xml.xpath.ui.internal.views.XPathComputer.setText(XPathComputer.java:146)
	at org.eclipse.wst.xml.xpath.ui.internal.views.XPathView.recomputeXPath(XPathView.java:293)
	at org.eclipse.wst.xml.xpath.ui.internal.views.XPathView.editorActivated(XPathView.java:378)
	at org.eclipse.wst.xml.xpath.ui.internal.views.XPathView.initEditorListener(XPathView.java:353)
	at org.eclipse.wst.xml.xpath.ui.internal.views.XPathView.createPartControl(XPathView.java:204)
	at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:375)
	at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:229)
	at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
	at org.eclipse.ui.internal.Perspective.showView(Perspective.java:2245)
	at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1145)
	at org.eclipse.ui.internal.WorkbenchPage$20.run(WorkbenchPage.java:3921)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3918)