Bug 319876 - [exceptions] NPE entering doc in *.js file
Summary: [exceptions] NPE entering doc in *.js file
Status: NEW
Alias: None
Product: JSDT
Classification: WebTools
Component: General (show other bugs)
Version: 3.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: Future   Edit
Assignee: Project Inbox CLA
QA Contact: Chris Jaun CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-14 12:12 EDT by Michael Rennie CLA
Modified: 2013-11-05 18:27 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Rennie CLA 2010-07-14 12:12:40 EDT
build: 1.2.0.v201006041342-7C78FGDF9JgLWLMLM4Vsye

I was editing some JSdoc in one of my JS file and the following NPE appeared in the log:


java.lang.NullPointerException
	at org.eclipse.wst.jsdt.internal.corext.codemanipulation.StubUtility.getMethodComment(StubUtility.java:595)
	at org.eclipse.wst.jsdt.ui.CodeGeneration.getMethodComment(CodeGeneration.java:150)
	at org.eclipse.wst.jsdt.internal.ui.text.correction.JavadocTagsSubProcessor.getMissingJavadocCommentProposals(JavadocTagsSubProcessor.java:311)
	at org.eclipse.wst.jsdt.internal.ui.text.correction.QuickFixProcessor.process(QuickFixProcessor.java:381)
	at org.eclipse.wst.jsdt.internal.ui.text.correction.QuickFixProcessor.getCorrections(QuickFixProcessor.java:193)
	at org.eclipse.wst.jsdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionCollector.safeRun(JavaCorrectionProcessor.java:355)
	at org.eclipse.wst.jsdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.run(JavaCorrectionProcessor.java:317)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.wst.jsdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.process(JavaCorrectionProcessor.java:313)
	at org.eclipse.wst.jsdt.internal.ui.text.correction.JavaCorrectionProcessor.collectCorrections(JavaCorrectionProcessor.java:442)
	at org.eclipse.wst.jsdt.internal.ui.text.correction.CorrectionMarkerResolutionGenerator.internalGetResolutions(CorrectionMarkerResolutionGenerator.java:511)
	at org.eclipse.wst.jsdt.internal.ui.text.correction.CorrectionMarkerResolutionGenerator.getResolutions(CorrectionMarkerResolutionGenerator.java:484)
	at org.eclipse.ui.internal.ide.registry.MarkerHelpRegistry.getResolutions(MarkerHelpRegistry.java:253)
	at org.eclipse.ui.internal.views.markers.QuickFixHandler$1.run(QuickFixHandler.java:87)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
	at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507)
	at org.eclipse.ui.internal.progress.ProgressManager$RunnableWithStatus.run(ProgressManager.java:1346)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.progress.ProgressManager$7.run(ProgressManager.java:1184)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:179)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4294)
	at org.eclipse.ui.internal.progress.ProgressManager.runInUI(ProgressManager.java:1182)
	at org.eclipse.ui.internal.progress.WorkbenchSiteProgressService.runInUI(WorkbenchSiteProgressService.java:376)
	at org.eclipse.ui.internal.views.markers.QuickFixHandler.execute(QuickFixHandler.java:124)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
	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:468)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:786)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:885)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:567)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:508)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:123)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1525)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1257)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1267)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1294)
	at org.eclipse.swt.widgets.Widget.gtk_key_press_event(Widget.java:730)
	at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:2839)
	at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:734)
	at org.eclipse.swt.widgets.Tree.gtk_key_press_event(Tree.java:1977)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1743)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4794)
	at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:3485)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4372)
	at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:8162)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1239)
	at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
	at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2223)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3169)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	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:369)
	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:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)

I don't have exact steps on how to reproduce. I only noticed the exception in my log once I was done editing (after saving).
Comment 1 Chris Jaun CLA 2010-07-15 16:54:16 EDT
Judging from the stack trace this may have something to do with reading comments on anonymous functions as the NPE seems to pop up when asking for the function name.
Comment 2 Nitin Dahyabhai CLA 2011-04-27 22:49:32 EDT
Michael, can you attach that file?
Comment 3 Victor Rubezhny CLA 2013-10-31 14:10:59 EDT
It looks like this will never happen again after the following issue was fixed:

Bug #337572 Show no false positive semantic validation error message

Because after this fix the problem IProblem.JavadocMissing has never being reported.

If I'm correct, after fixing Bug #337572 the Severity Preference for "Missing JSDoc comments" is deprecated and isn't useful anymore (See "JavaScript->Validator->JSDoc" preference page.
Comment 4 Chris Jaun CLA 2013-11-01 11:26:00 EDT
You may be right about that preference option not having any effect. Should look into that a bit, but I'm not sure that would prevent this error in the StubUtility class from happening again.
Comment 5 Victor Rubezhny CLA 2013-11-01 12:23:19 EDT
There are no a call to this code (from StubUtility), so getMissingJavaDocCommentProposals() isn't used anymore.

When I enabled IProblem.JavadocMissing problem to be reported (for a test purposes) and tried to use it. I faced 'assert null return type' failures in different places but not the NPE mentioned in the issue:

!ENTRY org.eclipse.wst.jsdt.ui 4 2 2013-10-31 21:47:24.319
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.wst.jsdt.ui".
!STACK 0
org.eclipse.core.runtime.AssertionFailedException: null argument:Variable return_typenot defined
	at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
	at org.eclipse.wst.jsdt.internal.corext.template.java.CodeTemplateContext.evaluate(CodeTemplateContext.java:54)
	at org.eclipse.wst.jsdt.internal.corext.codemanipulation.StubUtility.getMethodComment(StubUtility.java:608)
	at org.eclipse.wst.jsdt.ui.CodeGeneration.getMethodComment(CodeGeneration.java:150)
	at org.eclipse.wst.jsdt.internal.ui.text.correction.JavadocTagsSubProcessor.getMissingJavadocCommentProposals(JavadocTagsSubProcessor.java:311)
	at org.eclipse.wst.jsdt.internal.ui.text.correction.QuickFixProcessor.process(QuickFixProcessor.java:381)
	at org.eclipse.wst.jsdt.internal.ui.text.correction.QuickFixProcessor.getCorrections(QuickFixProcessor.java:193)
	at org.eclipse.wst.jsdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionCollector.safeRun(JavaCorrectionProcessor.java:355)
	at org.eclipse.wst.jsdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.run(JavaCorrectionProcessor.java:317)

So, it seams that either some code has changed here since the issue was reported, or we need author's test case due to reproduce the issue.

For this reason I didn't post those assertion failures in another issue (they will never be shown if we'll keep 'Ignore' severity for this problem).

When Bug #337572 was fixed there wasn't done much clean up for according validating methods, so the validation is still performed, but the problems found are just not reporting. It's not good for the performance.

But IMHO, that was not good idea of removing all those validation problems (and their severity preferences) that were removed in #337572. My strong point of view - we should keep all or most of them, but setup their default severity to 'Ignore', thus giving the users an ability to perform a stronger validation of their code if they need it. 

> but I'm not sure that would prevent this error in the StubUtility class from happening again.

Yes, sure it will not prevent these NPEs from happening again, but I see no more NPEs in the same place reported in other issues.
Comment 6 Chris Jaun CLA 2013-11-05 16:31:01 EST
Victor, do you have any comments on this bug?
https://bugs.eclipse.org/bugs/show_bug.cgi?id=420333

Is a proposal to remove even more validation from JSDT. Since you mentioned the removal of validation in your last comment here, thought I'd get your thoughts on that one as well.
Comment 7 Victor Rubezhny CLA 2013-11-05 18:27:48 EST
Chris, I've posted my opinion there: bug #420333.