You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Gili (JIRA)" <ji...@apache.org> on 2018/01/16 19:36:01 UTC

[jira] [Comment Edited] (NETBEANS-277) NPE at org.netbeans.modules.java.editor.imports.FastImportAction$1.run(FastImportAction.java:100)

    [ https://issues.apache.org/jira/browse/NETBEANS-277?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16327654#comment-16327654 ] 

Gili edited comment on NETBEANS-277 at 1/16/18 7:35 PM:
--------------------------------------------------------

I am able to reproduce the bug using the following file inside a Maven project:

  
{code:java}
package testcase.fastimportnpe;
import java.math.BigDecimal;
final class TradeStream {
  private final Object websocketListener = new Object() {
    public void onWebSocketText(String data) {
      BigDecimal amount = new BigDecimal(undefined);
    }
  };
}
{code}
The bug seems to be intermittent, having something to do with the parser state. Sometimes when I invoke ALT+SHIFT+I on "BigDecimal" (the left one) I get the exception. Other times I don't. If you are unable to reproduce the problem, try closing the file in the editor, reopen it and try again. This seems to help in my case.

 


was (Author: cowwoc):
I am able to reproduce the bug using the following file inside a Maven project:

 

 
{code:java}
package testcase.fastimportnpe;
import java.math.BigDecimal;
final class TradeStream {
  private final Object websocketListener = new Object() {
    public void onWebSocketText(String data) {
      BigDecimal amount = new BigDecimal(undefined);
    }
  };
}
{code}
The bug seems to be intermittent, having something to do with the parser state. Sometimes when I invoke ALT+SHIFT+I on "BigDecimal" (the left one) I get the exception. Other times I don't. If you are unable to reproduce the problem, try closing the file in the editor, reopen it and try again. This seems to help in my case.

 

> NPE at org.netbeans.modules.java.editor.imports.FastImportAction$1.run(FastImportAction.java:100)
> -------------------------------------------------------------------------------------------------
>
>                 Key: NETBEANS-277
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-277
>             Project: NetBeans
>          Issue Type: Bug
>          Components: java - Source
>         Environment: Product Version: Apache NetBeans IDE Dev (Build 20180106-unknown-revn)
> Updates: Updates available
> Java: 9.0.1; Java HotSpot(TM) 64-Bit Server VM 9.0.1+11
> Runtime: Java(TM) SE Runtime Environment 9.0.1+11
> System: Windows 10 version 10.0 running on amd64; Cp1252; en_CA (nb)
> User directory: C:\Users\Gili\AppData\Roaming\NetBeans\dev
> Cache directory: C:\Users\Gili\AppData\Local\NetBeans\Cache\dev
>            Reporter: Gili
>            Priority: Major
>         Attachments: TradeStream.java
>
>
> 1. Open attached file.
> 2. Position caret on the first word of line 79 ("BigDecimal")
> 3. Hit ALT+SHIFT+I
> 4. Exception thrown:
> {code}
> java.lang.NullPointerException
> 	at javax.lang.model.util.ElementFilter.listFilter(ElementFilter.java:216)
> 	at javax.lang.model.util.ElementFilter.typesIn(ElementFilter.java:154)
> 	at org.netbeans.modules.java.editor.imports.FastImportAction$1.run(FastImportAction.java:100)
> 	at org.netbeans.modules.java.editor.imports.FastImportAction$1.run(FastImportAction.java:90)
> 	at org.netbeans.api.java.source.JavaSource$MultiTask.run(JavaSource.java:501)
> 	at org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:586)
> 	at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:130)
> 	at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:114)
> 	at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:181)
> 	at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:178)
> 	at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:153)
> 	at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:335)
> 	at org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:118)
> 	at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:67)
> 	at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:178)
> 	at org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:81)
> 	at org.netbeans.api.java.source.JavaSource.runUserActionTaskImpl(JavaSource.java:451)
> 	at org.netbeans.api.java.source.JavaSource.runUserActionTask(JavaSource.java:422)
> 	at org.netbeans.modules.java.editor.imports.FastImportAction$2.run(FastImportAction.java:126)
> 	at org.netbeans.modules.progress.ui.RunOffEDTImpl$1.run(RunOffEDTImpl.java:146)
> 	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
> 	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
> 	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
> 	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
> Caused: org.openide.util.RequestProcessor$SlowItem: task failed due to
> 	at org.openide.util.RequestProcessor.post(RequestProcessor.java:395)
> 	at org.netbeans.modules.progress.ui.RunOffEDTImpl.runOffEventDispatchThreadImpl(RunOffEDTImpl.java:140)
> 	at org.netbeans.modules.progress.ui.RunOffEDTImpl.runOffEventDispatchThread(RunOffEDTImpl.java:83)
> 	at org.netbeans.api.progress.BaseProgressUtils.runOffEventDispatchThread(BaseProgressUtils.java:90)
> 	at org.netbeans.api.progress.ProgressUtils.runOffEventDispatchThread(ProgressUtils.java:67)
> 	at org.netbeans.modules.java.editor.imports.FastImportAction.actionPerformed(FastImportAction.java:122)
> 	at org.netbeans.editor.BaseAction.actionPerformed(BaseAction.java:322)
> 	at java.desktop/javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1805)
> 	at java.desktop/javax.swing.JComponent.processKeyBinding(JComponent.java:2901)
> 	at java.desktop/javax.swing.JComponent.processKeyBindings(JComponent.java:2949)
> 	at java.desktop/javax.swing.JComponent.processKeyEvent(JComponent.java:2863)
> 	at java.desktop/java.awt.Component.processEvent(Component.java:6355)
> 	at java.desktop/java.awt.Container.processEvent(Container.java:2259)
> 	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4961)
> 	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2317)
> 	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4793)
> 	at java.desktop/java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1955)
> 	at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:827)
> 	at java.desktop/java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1096)
> 	at java.desktop/java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:966)
> 	at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:792)
> 	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4842)
> 	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2317)
> 	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2758)
> 	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4793)
> 	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:766)
> 	at java.desktop/java.awt.EventQueue.access$500(EventQueue.java:97)
> 	at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:717)
> 	at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:711)
> 	at java.base/java.security.AccessController.doPrivileged(Native Method)
> 	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:89)
> 	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:99)
> 	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:739)
> 	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:737)
> 	at java.base/java.security.AccessController.doPrivileged(Native Method)
> 	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:89)
> 	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:736)
> 	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
> 	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:199)
> 	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
> 	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
> 	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
> 	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
> [catch] at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists