Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-4530

NPE for specific textmate grammar

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 12.0, 12.4
    • None
    • textmate-lexer
    • None

    Description

      When I use this grammar file: https://github.com/pragmagic/vscode-nim/blob/master/syntaxes/nim.json for the nim language, I got a NPE:

      java.lang.NullPointerException
      	at org.eclipse.tm4e.core.internal.grammar.Grammar._tokenize(Grammar.java:220)
      	at org.eclipse.tm4e.core.internal.grammar.Grammar.tokenizeLine(Grammar.java:191)
      	at org.netbeans.modules.textmate.lexer.TextmateLexer.nextToken(TextmateLexer.java:75)
      	at org.netbeans.lib.lexer.LexerInputOperation.nextToken(LexerInputOperation.java:191)
      	at org.netbeans.lib.lexer.inc.IncTokenList.tokenOrEmbeddingImpl(IncTokenList.java:170)
      	at org.netbeans.lib.lexer.inc.IncTokenList.tokenOrEmbedding(IncTokenList.java:165)
      	at org.netbeans.api.lexer.TokenSequence.moveNext(TokenSequence.java:463)
      	at org.netbeans.modules.textmate.lexer.SyntaxHighlighting$TSInfo.moveNextToken(SyntaxHighlighting.java:779)
      	at org.netbeans.modules.textmate.lexer.SyntaxHighlighting$HSImpl.moveTheSequence(SyntaxHighlighting.java:476)
      	at org.netbeans.modules.textmate.lexer.SyntaxHighlighting$HSImpl.moveNext(SyntaxHighlighting.java:405)
      	at org.netbeans.modules.editor.lib2.highlighting.DirectMergeContainer$Wrapper.fetchNextHighlight(DirectMergeContainer.java:600)
      	at org.netbeans.modules.editor.lib2.highlighting.DirectMergeContainer$HlSequence.updateMergeVars(DirectMergeContainer.java:337)
      	at org.netbeans.modules.editor.lib2.highlighting.DirectMergeContainer$HlSequence.nextMerge(DirectMergeContainer.java:303)
      	at org.netbeans.modules.editor.lib2.highlighting.DirectMergeContainer$HlSequence.moveNext(DirectMergeContainer.java:234)
      	at org.netbeans.modules.editor.lib2.highlighting.HighlightsReader.readUntil(HighlightsReader.java:59)
      	at org.netbeans.modules.editor.lib2.view.HighlightsViewFactory.restart(HighlightsViewFactory.java:168)
      	at org.netbeans.modules.editor.lib2.view.ViewBuilder$FactoryState.init(ViewBuilder.java:1299)
      	at org.netbeans.modules.editor.lib2.view.ViewBuilder.createViews(ViewBuilder.java:699)
      	at org.netbeans.modules.editor.lib2.view.ViewBuilder.createReplaceRepaintViews(ViewBuilder.java:660)
      	at org.netbeans.modules.editor.lib2.view.ViewUpdates.reinitAllViews(ViewUpdates.java:189)
      	at org.netbeans.modules.editor.lib2.view.DocumentViewOp.checkViewsInited(DocumentViewOp.java:619)
      	at org.netbeans.modules.editor.lib2.view.DocumentView.getPreferredSpan(DocumentView.java:226)
      	at java.desktop/javax.swing.plaf.basic.BasicTextUI$RootView.getPreferredSpan(BasicTextUI.java:1452)
      	at java.desktop/javax.swing.plaf.basic.BasicTextUI.getPreferredSize(BasicTextUI.java:957)
      	at java.desktop/javax.swing.JComponent.getPreferredSize(JComponent.java:1680)
      	at java.desktop/javax.swing.JEditorPane.getPreferredSize(JEditorPane.java:1345)
      	at org.netbeans.modules.editor.NbEditorUI$LayeredEditorPane.getPreferredSize(NbEditorUI.java:453)
      	at java.desktop/javax.swing.ScrollPaneLayout.layoutContainer(ScrollPaneLayout.java:795)
      	at java.desktop/java.awt.Container.layout(Container.java:1537)
      	at java.desktop/java.awt.Container.doLayout(Container.java:1526)
      	at java.desktop/java.awt.Container.validateTree(Container.java:1722)
      	at java.desktop/java.awt.Container.validateTree(Container.java:1731)
      	at java.desktop/java.awt.Container.validateTree(Container.java:1731)
      	at java.desktop/java.awt.Container.validateTree(Container.java:1731)
      	at java.desktop/java.awt.Container.validateTree(Container.java:1731)
      	at java.desktop/java.awt.Container.validateTree(Container.java:1731)
      	at java.desktop/java.awt.Container.validateTree(Container.java:1731)
      	at java.desktop/java.awt.Container.validateTree(Container.java:1731)
      	at java.desktop/java.awt.Container.validateTree(Container.java:1731)
      	at java.desktop/java.awt.Container.validate(Container.java:1657)
      	at org.netbeans.core.windows.view.ui.DesktopImpl$LayeredLayout.layoutContainer(DesktopImpl.java:529)
      	at java.desktop/java.awt.Container.layout(Container.java:1537)
      	at java.desktop/java.awt.Container.doLayout(Container.java:1526)
      	at java.desktop/java.awt.Container.validateTree(Container.java:1722)
      	at java.desktop/java.awt.Container.validateTree(Container.java:1731)
      	at java.desktop/java.awt.Container.validateTree(Container.java:1731)
      	at java.desktop/java.awt.Container.validateTree(Container.java:1731)
      	at java.desktop/java.awt.Container.validateTree(Container.java:1731)
      	at java.desktop/java.awt.Container.validate(Container.java:1657)
      	at java.desktop/javax.swing.RepaintManager$3.run(RepaintManager.java:745)
      	at java.desktop/javax.swing.RepaintManager$3.run(RepaintManager.java:743)
      	at java.base/java.security.AccessController.doPrivileged(Native Method)
      	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
      	at java.desktop/javax.swing.RepaintManager.validateInvalidComponents(RepaintManager.java:742)
      	at java.desktop/javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1889)
      	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
      	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
      	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
      	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
      	at java.base/java.security.AccessController.doPrivileged(Native Method)
      	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
      	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
      	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
      [catch] at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
      	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)
      	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
      
      

      when I open the file (Attachement example.nim).

      Steps to reproduce:

      • Open options
      • Go to Editor -> Language Server
      • Create a new entry for ".nim" files
      • Add the textmate file from the link in this description
      • Save the entry and apply the options
      • Open the example.nim file
      • See no syntax highlighting and see the NPE as mentioned.

      Attachments

        1. example.d
          0.5 kB
          Christian Lenz
        2. example.nim
          0.2 kB
          Christian Lenz

        Activity

          People

            jlahoda Jan Lahoda
            chrizzly Christian Lenz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: