Bug 300670 - [misc] Open Attached JSDoc throws NPE
Summary: [misc] Open Attached JSDoc throws NPE
Status: NEW
Alias: None
Product: JSDT
Classification: WebTools
Component: General (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: Future   Edit
Assignee: Project Inbox CLA
QA Contact: Chris Jaun CLA
URL:
Whiteboard:
Keywords: plan
Depends on:
Blocks:
 
Reported: 2010-01-25 08:38 EST by Wojciech Galanciak CLA
Modified: 2014-05-29 13:52 EDT (History)
5 users (show)

See Also:
cmjaun: review+


Attachments
test project (1.54 KB, application/x-zip)
2010-01-25 08:38 EST, Wojciech Galanciak CLA
no flags Details
test JSDoc (8.69 KB, application/x-zip)
2010-01-25 08:39 EST, Wojciech Galanciak CLA
no flags Details
Uses _symbol_ for the package/type part of the path for methods and fields that do not have a declaring type (5.18 KB, patch)
2011-02-09 21:41 EST, Nitin Dahyabhai CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wojciech Galanciak CLA 2010-01-25 08:38:51 EST
Created attachment 157114 [details]
test project

When Open Attached JSDoc option is chosen for method name NPE is thrown:
!ENTRY org.eclipse.ui 4 0 2010-01-25 14:29:07.781
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NullPointerException
	at org.eclipse.wst.jsdt.internal.corext.javadoc.JavaDocLocations.appendTypePath(JavaDocLocations.java:534)
	at org.eclipse.wst.jsdt.internal.corext.javadoc.JavaDocLocations.getJavadocLocation(JavaDocLocations.java:488)
	at org.eclipse.wst.jsdt.ui.JavaScriptUI.getJSdocLocation(JavaScriptUI.java:712)
	at org.eclipse.wst.jsdt.ui.actions.OpenExternalJavadocAction.run(OpenExternalJavadocAction.java:168)
	at org.eclipse.wst.jsdt.ui.actions.OpenExternalJavadocAction.run(OpenExternalJavadocAction.java:123)
	at org.eclipse.wst.jsdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:249)
	at org.eclipse.wst.jsdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:221)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
	at org.eclipse.ui.actions.RetargetAction.runWithEvent(RetargetAction.java:230)
	at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:234)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1050)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3931)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3524)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2407)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2371)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2220)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
	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:367)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:611)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:566)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1363)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1339)

Steps to reproduce:
1. Import attached test project.
2. Extract testJSDoc.
4. Set JSDoc location for folder with extracted JSDoc.
5. Set focus on project (in script explorer).
6. Choose Nagivate->Open Attached JSDoc - it works fine
7. Set cursor on Shape_getColor() function.
8. Choose Nagivate->Open Attached JSDoc - it throws NPE
Comment 1 Wojciech Galanciak CLA 2010-01-25 08:39:46 EST
Created attachment 157115 [details]
test JSDoc
Comment 2 Wojciech Galanciak CLA 2010-01-25 08:56:45 EST
It is thrown in org.eclipse.wst.jsdt.internal.corext.javadoc.JavaDocLocation.java:

case IJavaScriptElement.METHOD :
 IMember method= (IMember) element;
 appendTypePath(method.getDeclaringType(), pathBuffer);
 if (includeMemberReference) {
 	appendMethodReference((IFunction) method, pathBuffer);
 }
 break;

Shape_getColor() is detected as method but it doesn't so method.getDeclaringType() returns null.

In my opinion it is more overall problem with compatibility with different JSDoc implementations.
Comment 3 Nitin Dahyabhai CLA 2011-02-09 21:37:26 EST
More like it doesn't understand how to handle globals.  We can direct those to _global_.html fairly easily, but it's unrelated to addressing bug 300677.
Comment 4 Nitin Dahyabhai CLA 2011-02-09 21:41:21 EST
Created attachment 188642 [details]
Uses _symbol_ for the package/type part of the path for methods and fields that do not have a declaring type
Comment 5 Jon Houghton CLA 2013-06-19 11:35:44 EDT
I have reviewed this patch and recommend that it be included in 3.5.1.  Chris, can you officially review it.
Comment 6 Denis Golovin CLA 2013-10-18 18:50:06 EDT
Correction to Steps to reproduce:
1. Import attached test project.
2. Extract testJSDoc.
4. Set JSDoc location for folder with extracted JSDoc.
5. Set Focus on Test/JavaScript Resources/Test (in script explorer).
6. Choose Nagivate->Open External JSDoc - it works fine
7. Set cursor on Test/JavaScript Resources/Test/Shape_getColor() function.
8. Choose Nagivate->Open External JSDoc - it throws NPE