This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Product Version: NetBeans IDE Dev (Build 200807040101) Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b05 System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb) While editing Javascript, I bring up the completion window to find a method I want to use. I press ENTER to select the method for use. I then get the following error. The method template is still inserted, but I am not able to navigate the template as usual; I am left in regular edit mode. This has so far only happened when trying to use a method/function of an object. A regular property does not cause the error. java.util.NoSuchElementException at java.util.LinkedList.getFirst(LinkedList.java:109) at org.netbeans.modules.javascript.editing.JsPretty.handleToken(JsPretty.java:471) at org.netbeans.modules.javascript.editing.JsPretty.acceptNode(JsPretty.java:397) at org.netbeans.modules.javascript.editing.JsPretty.walk(JsPretty.java:105) at org.netbeans.modules.javascript.editing.JsPretty.visitDefault(JsPretty.java:184) at org.netbeans.modules.javascript.editing.JsPretty.walk(JsPretty.java:152) at org.netbeans.modules.javascript.editing.JsPretty.visitContinuation(JsPretty.java:196) at org.netbeans.modules.javascript.editing.JsPretty.walk(JsPretty.java:130) at org.netbeans.modules.javascript.editing.JsPretty.visitDefault(JsPretty.java:184) at org.netbeans.modules.javascript.editing.JsPretty.walk(JsPretty.java:152) at org.netbeans.modules.javascript.editing.JsPretty.format(JsPretty.java:93) at org.netbeans.modules.javascript.editing.JsFormatter.reformat(JsFormatter.java:136) at org.netbeans.modules.gsf.GsfReformatTask.reformat(GsfReformatTask.java:100) at org.netbeans.modules.editor.indent.TaskHandler$MimeItem.runTask(TaskHandler.java:504) at org.netbeans.modules.editor.indent.TaskHandler.runTasks(TaskHandler.java:271) at org.netbeans.modules.editor.indent.IndentImpl.reformat(IndentImpl.java:293) at org.netbeans.modules.editor.indent.FormatterImpl.reformat(FormatterImpl.java:163) at org.netbeans.lib.editor.codetemplates.CodeTemplateInsertHandler.insertTemplate(CodeTemplateInsertHandler.java:298) at org.netbeans.lib.editor.codetemplates.CodeTemplateInsertHandler.processTemplate(CodeTemplateInsertHandler.java:220) at org.netbeans.lib.editor.codetemplates.CodeTemplateManagerOperation.insert(CodeTemplateManagerOperation.java:238) at org.netbeans.lib.editor.codetemplates.api.CodeTemplate.insert(CodeTemplate.java:104) at org.netbeans.modules.gsfret.editor.completion.GsfCompletionItem$DelegatedItem.defaultSubstituteText(GsfCompletionItem.java:307) at org.netbeans.modules.gsfret.editor.completion.GsfCompletionItem$DelegatedItem.substituteText(GsfCompletionItem.java:282) at org.netbeans.modules.gsfret.editor.completion.GsfCompletionItem.defaultAction(GsfCompletionItem.java:467) at org.netbeans.modules.editor.completion.CompletionImpl.dispatchKeyEvent(CompletionImpl.java:564) at org.netbeans.modules.editor.completion.CompletionImpl.keyPressed(CompletionImpl.java:364) at java.awt.AWTEventMulticaster.keyPressed(AWTEventMulticaster.java:233) at java.awt.AWTEventMulticaster.keyPressed(AWTEventMulticaster.java:232) at java.awt.Component.processKeyEvent(Component.java:5996) at javax.swing.JComponent.processKeyEvent(JComponent.java:2799) at java.awt.Component.processEvent(Component.java:5815) at java.awt.Container.processEvent(Container.java:2058) at java.awt.Component.dispatchEventImpl(Component.java:4410) at java.awt.Container.dispatchEventImpl(Container.java:2116) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1848) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:697) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:962) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:834) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:661) at java.awt.Component.dispatchEventImpl(Component.java:4282) at java.awt.Container.dispatchEventImpl(Container.java:2116) at java.awt.Window.dispatchEventImpl(Window.java:2429) at java.awt.Component.dispatchEvent(Component.java:4240) [catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Assign to correct component.
Can you please provide code sample where this happened, together with cursor position where to invoke completion? Thanks.
I wasn't able to reproduce, so tried blind fix. http://hg.netbeans.org/main/rev/ce6d5b4349aa
Integrated into 'main-golden', available in build *200807310201* on http://bits.netbeans.org/dev/nightly/ Changeset: http://hg.netbeans.org/main/rev/ce6d5b4349aa User: Martin Adamek <martin_adamek@netbeans.org> Log: Blind fix for #139300: Exception when selecting method from code completion
Apologies for the delay. This problem is a bit obscure, so it took me some time to narrow it down to a specific code example. As it turns out, it's quite simple: for (var i = 0 ; i < 10 ; i++) // '{' on the NEXT LINE!!! { // any code } // Put cursor at the end of this line, and start the completion template for // the 'eval' function window.eva I then get the "NoSuchElementException at java.util.LinkedList.getFirst(LinkedList.java:109)". Things are then in a bad state, and if I put the brace on the line of the 'for', restart the template for the eval() function, and hit RETURN, I get the exception below. I can not get out of this state unless I reopen the file. java.lang.NullPointerException at org.netbeans.lib.editor.codetemplates.CodeTemplateInsertHandler.release(CodeTemplateInsertHandler.java:425) at org.netbeans.lib.editor.codetemplates.CodeTemplateInsertHandler.released (CodeTemplateInsertHandler.java:452) at org.netbeans.lib.editor.codetemplates.textsync.TextRegionEditing.releaseActiveGroup (TextRegionEditing.java:271) at org.netbeans.lib.editor.codetemplates.textsync.TextRegionEditing.activateTextSync (TextRegionEditing.java:225) at org.netbeans.lib.editor.codetemplates.textsync.TextRegionEditing.enterAction(TextRegionEditing.java:306) at org.netbeans.lib.editor.codetemplates.textsync.TextRegionEditing$OverrideAction.actionPerformed (TextRegionEditing.java:452) at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1636) at javax.swing.JComponent.processKeyBinding(JComponent.java:2849) at javax.swing.JComponent.processKeyBindings(JComponent.java:2884) at javax.swing.JComponent.processKeyEvent(JComponent.java:2812) at java.awt.Component.processEvent(Component.java:5815) at java.awt.Container.processEvent(Container.java:2058) at java.awt.Component.dispatchEventImpl(Component.java:4410) at java.awt.Container.dispatchEventImpl(Container.java:2116) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1848) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:697) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:962) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:834) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:661) at java.awt.Component.dispatchEventImpl(Component.java:4282) at java.awt.Container.dispatchEventImpl(Container.java:2116) at java.awt.Window.dispatchEventImpl(Window.java:2429) at java.awt.Component.dispatchEvent(Component.java:4240) [catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Exactly that NoSuchElementException was fixed on Wed Jul 30. Can you please check the build number you are using?
Btw, with you recent steps to reproduce I was able to reproduce it in older build easily. But mentioned problem is fixed in latest builds.
The build is the same as in my opening comments. I trust that it is fixed. I'm just glad that we were able to confirm that it was the same problem I was seeing.
Ok, your steps to reproduce helped, thanks!
*** Issue 142104 has been marked as a duplicate of this issue. ***