SonarQube Eclipse
  1. SonarQube Eclipse
  2. SONARIDE-292

checkstyle default encoding problem: Unexpected character 0xfffd in identifier

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 3.0
    • Component/s: Java
    • Labels:
    • Environment:
      windows 2003 with Chinese Locale
    • Number of attachments :
      0

      Description

      An internal error occurred during: "Sonar Analysis"

      AppStateEnum.java encoding is "UTF-8",My OS default encoding is GBK(Chinese Locale)

      rg.picocontainer.PicoLifecycleException: PicoLifecycleException: method 'public void org.sonar.batch.components.EmbedderPhases.start()', instance 'org.sonar.batch.components.EmbedderPhases@1ad0692, java.lang.RuntimeException: wrapper
          at org.picocontainer.monitors.NullComponentMonitor.lifecycleInvocationFailed(NullComponentMonitor.java:77)
          at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.monitorAndThrowReflectionLifecycleException(ReflectionLifecycleStrategy.java:132)
          at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:115)
          at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89)
          at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
          at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
          at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
          at org.picocontainer.behaviors.Stored.start(Stored.java:110)
          at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:996)
          at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:989)
          at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:746)
          at org.sonar.batch.Module.start(Module.java:88)
          at org.sonar.batch.SonarEclipseRuntime.analyse(SonarEclipseRuntime.java:44)
          at org.sonar.ide.eclipse.core.jobs.AnalyseProjectJob.run(AnalyseProjectJob.java:107)
          at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
      Caused by: java.lang.RuntimeException: wrapper
          at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.monitorAndThrowReflectionLifecycleException(ReflectionLifecycleStrategy.java:130)
          ... 13 more
      Caused by: org.sonar.squid.api.AnalysisException: Got an exception - Unexpected character 0xfffd in identifier, file : E:\MyEclipseWs\branchitech-app\src\com\branchitech\app\AppStateEnum.java, line : 28
          at org.sonar.java.ast.CheckstyleAuditListener.addError(CheckstyleAuditListener.java:40)
          at com.puppycrawl.tools.checkstyle.Checker.fireErrors(Checker.java:513)
          at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:279)
          at org.sonar.java.ast.JavaAstScanner.launchCheckstyle(JavaAstScanner.java:129)
          at org.sonar.java.ast.JavaAstScanner.scanFiles(JavaAstScanner.java:118)
      

        Activity

        Hide
        QXO added a comment - - edited

        add "-Dfile.encoding=UTF-8" to eclipse.ini(-vmargs) will temporary solve the problem
        eg:

        -vmargs
        -Dosgi.requiredJavaVersion=1.5
        -Xmn128m
        -Xms256m
        -Xmx768m
        -Xss1m
        -XX:PermSize=128m
        -XX:MaxPermSize=384m
        -Dfile.encoding=UTF-8
        
        Show
        QXO added a comment - - edited add "-Dfile.encoding=UTF-8" to eclipse.ini(-vmargs) will temporary solve the problem eg: -vmargs -Dosgi.requiredJavaVersion=1.5 -Xmn128m -Xms256m -Xmx768m -Xss1m -XX:PermSize=128m -XX:MaxPermSize=384m -Dfile.encoding=UTF-8
        Hide
        Freddy Mallet added a comment -

        This error won't happen anymore by using Sonar 3.3 (SSLR java parser) and Sonar Eclipse 2.5

        Show
        Freddy Mallet added a comment - This error won't happen anymore by using Sonar 3.3 (SSLR java parser) and Sonar Eclipse 2.5
        Hide
        Freddy Mallet added a comment -

        In fact we should reuse the file encoding defined on the Eclipse project

        Show
        Freddy Mallet added a comment - In fact we should reuse the file encoding defined on the Eclipse project
        Hide
        Julien HENRY added a comment -

        I am taking encoding from Eclipse project level and passing it to sonar.sourceEncoding parameter.

        Show
        Julien HENRY added a comment - I am taking encoding from Eclipse project level and passing it to sonar.sourceEncoding parameter.
        Hide
        Freddy Mallet added a comment -

        Well done Julien !

        Show
        Freddy Mallet added a comment - Well done Julien !

          People

          • Assignee:
            Julien HENRY
            Reporter:
            QXO
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: