Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 263843 - NPE from invoking content assist in empty XSL file
Summary: NPE from invoking content assist in empty XSL file
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xsl (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1   Edit
Assignee: David Carver CLA
QA Contact: Doug CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 264360
  Show dependency tree
 
Reported: 2009-02-05 13:57 EST by Nick Sandonato CLA
Modified: 2009-04-30 14:26 EDT (History)
2 users (show)

See Also:


Attachments
Provide proposals when No Region is found (2.77 KB, patch)
2009-02-10 10:19 EST, David Carver CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Sandonato CLA 2009-02-05 13:57:02 EST
If I create an empty (not even the XML declaration) .xsl file and invoke content assist I get an NPE with the trace at the bottom.

I think it would be helpful if when content assist is invoked it suggests a template, much like in an empty XML file the suggestion will be the XML declaration template.

java.lang.NullPointerException
	at org.eclipse.wst.xsl.ui.internal.contentassist.XSLElementContentAssistRequest.getCompletionProposals(XSLElementContentAssistRequest.java:65)
	at org.eclipse.wst.xsl.ui.internal.contentassist.XSLContentAssistProcessor.getAdditionalXSLElementProposals(XSLContentAssistProcessor.java:138)
	at org.eclipse.wst.xsl.ui.internal.contentassist.XSLContentAssistProcessor.computeCompletionProposals(XSLContentAssistProcessor.java:88)
	at org.eclipse.wst.sse.ui.internal.contentassist.CompoundContentAssistProcessor.computeCompletionProposals(CompoundContentAssistProcessor.java:303)
	at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1832)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:556)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$16(CompletionProposalPopup.java:553)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run(CompletionProposalPopup.java:488)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:482)
	at org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1660)
	at org.eclipse.wst.sse.ui.internal.StructuredTextViewer.doOperation(StructuredTextViewer.java:446)
	at org.eclipse.ui.texteditor.TextOperationAction$1.run(TextOperationAction.java:131)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.texteditor.TextOperationAction.run(TextOperationAction.java:129)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
	at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:185)
	at org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:109)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:471)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:823)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:879)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:570)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:511)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:126)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1190)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1002)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1027)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1040)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1036)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1358)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4019)
	at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:346)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:3912)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:342)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4584)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2393)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3468)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2388)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2352)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2204)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:499)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:333)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:492)
	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:194)
	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:368)
	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:79)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:618)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:556)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:511)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1270)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1246)
Comment 1 David Carver CLA 2009-02-10 01:17:48 EST
Agreed.  I'll write up a unit test for this, and address it in 1.0M6.  Had not thought of the case where there is nothing in a file.

Comment 2 David Carver CLA 2009-02-10 10:19:25 EST
Created attachment 125250 [details]
Provide proposals when No Region is found

This patch fixes the case when there is no region, and content assist is requested.  It should return at least the default XML proposals that are available.  A separate enhancement request will be opened to provide XSL File proposals.
Comment 3 David Carver CLA 2009-02-10 13:12:11 EST
I have this fixed, but the build machine does not seem to be pulling the correct file.  Once I get that resolved and verified that the unit test passes on the build machine I'll resolve this issue.
Comment 4 David Carver CLA 2009-02-10 22:22:35 EST
This should now be fixed, and is released to head.
Comment 5 David Carver CLA 2009-04-30 14:26:55 EDT
mass update to 3.1 target due to movement from wtp incubator to wtp source editing lost the original milestones.