SonarQube JavaScript
  1. SonarQube JavaScript
  2. SONARJS-167

When a JavaScript file starts with the BOM(Byte Order Mark) character, the source code can't be parsed

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.1
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      1

      Description

      The following exception is thrown :

      13:44:27  Embedded error: Unable to lex url: file:/.....js
      13:44:27  None of the channel has been able to handle character '' (decimal value 65279) at line 1, column 0
      13:44:27  [INFO] ------------------------------------------------------------------------
      13:44:27  [INFO] Trace
      13:44:27  org.apache.maven.lifecycle.LifecycleExecutionException: Can not execute Sonar
      13:44:27               at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleE
      

        Issue Links

          Activity

          Hide
          Papapetrou Patroklos added a comment -

          I've seen the same message while parsing PowerBuilder files (with my under development plugin) so I supppose that it's not only restricted to JavaScript but it has to do with SSLR

          Caused by: java.lang.IllegalStateException: None of the channel has been able to handle character '`' (decimal value 96) at line 143, column 21
                  at org.sonar.channel.ChannelDispatcher.consume(ChannelDispatcher.java:86) ~[sonar-channel-3.0.1.jar:na]
                  at com.sonar.sslr.impl.Lexer.lex(Lexer.java:126) ~[sslr-core-1.13.jar:na]
          

          The problematic characters are : '`' and '\'

          Show
          Papapetrou Patroklos added a comment - I've seen the same message while parsing PowerBuilder files (with my under development plugin) so I supppose that it's not only restricted to JavaScript but it has to do with SSLR Caused by: java.lang.IllegalStateException: None of the channel has been able to handle character '`' (decimal value 96) at line 143, column 21 at org.sonar.channel.ChannelDispatcher.consume(ChannelDispatcher.java:86) ~[sonar-channel-3.0.1.jar:na] at com.sonar.sslr.impl.Lexer.lex(Lexer.java:126) ~[sslr-core-1.13.jar:na] The problematic characters are : '`' and '\'
          Hide
          Evgeny Mandrikov added a comment -

          This is not a problem of SSLR, but a problem of consumer of SSLR API, in this case - problem in JavaScript Plugin.
          This message simply says that rules for Lexer were constructed in a such way that they doesn't allow to consume char on a given input position.
          In case of JavaScript - lexer is unable to handle one special character, which is known as BOM.
          And in case of your work on PowerBuilder this might be a clear indication that lexer is badly implemented, however hard to say without code.

          P.S. Please in future don't mix real bugs in existing plugins with new developments.

          Show
          Evgeny Mandrikov added a comment - This is not a problem of SSLR, but a problem of consumer of SSLR API, in this case - problem in JavaScript Plugin. This message simply says that rules for Lexer were constructed in a such way that they doesn't allow to consume char on a given input position. In case of JavaScript - lexer is unable to handle one special character, which is known as BOM. And in case of your work on PowerBuilder this might be a clear indication that lexer is badly implemented, however hard to say without code. P.S. Please in future don't mix real bugs in existing plugins with new developments.
          Hide
          Oliver added a comment -

          A file which triggers the error condition

          Show
          Oliver added a comment - A file which triggers the error condition
          Hide
          Oliver added a comment -

          This would be really good to fix. I reported the issue in jslint4java, and suggested a fix. Since moving away to SSLR, this will not be fixed by simply updating. See http://code.google.com/p/jslint4java/issues/detail?id=57 for the original report on that project. I have attached a js file that recreates this issue too.

          Show
          Oliver added a comment - This would be really good to fix. I reported the issue in jslint4java, and suggested a fix. Since moving away to SSLR, this will not be fixed by simply updating. See http://code.google.com/p/jslint4java/issues/detail?id=57 for the original report on that project. I have attached a js file that recreates this issue too.
          Hide
          Freddy Mallet added a comment -

          "Seems" to work the provided sample file but I'm not sure : which encoding should be used to read this source file ? Indeed with some encoding I get an exception and with some others the BOM character seems to be considered as being part of the function name.

          Show
          Freddy Mallet added a comment - "Seems" to work the provided sample file but I'm not sure : which encoding should be used to read this source file ? Indeed with some encoding I get an exception and with some others the BOM character seems to be considered as being part of the function name.
          Hide
          Evgeny Mandrikov added a comment -

          any of Unicode

          Show
          Evgeny Mandrikov added a comment - any of Unicode

            People

            • Assignee:
              Evgeny Mandrikov
              Reporter:
              Freddy Mallet
            • Votes:
              4 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: