5.2升级IllegalArgumentException:无法突出显示文件

时间:2015-11-05 17:44:54

标签: css sonarqube

升级到SonarQube 5.2并将所有插件升级到当前版本后,运行分析时出现以下异常。这个问题与CSS插件或核心sonarqube有关吗?

最终记忆:9M / 181M 信息:------------------------------------------------ ------------------------

org.sonar.runner.impl.RunnerException: Unable to execute Sonar
○at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
○at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
○at java.security.AccessController.doPrivileged(Native Method)
○at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
○at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
○at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
○at org.sonar.runner.api.Runner.execute(Runner.java:100)
○at org.sonar.runner.Main.executeTask(Main.java:70)
○at org.sonar.runner.Main.execute(Main.java:59)
○at org.sonar.runner.Main.main(Main.java:53)
Caused by: org.sonar.squidbridge.api.AnalysisException: Unable to analyze file: Site.css
○at org.sonar.squidbridge.AstScanner.scanFiles(AstScanner.java:127)
○at org.sonar.plugins.css.CssSquidSensor.analyse(CssSquidSensor.java:91)
○at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)
○at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50)
○at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:98)
○at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192)
○at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:100)
○at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:85)
○at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:258)
○at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:253)
○at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:251)
○at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:243)
○at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:100)
○at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:85)
○at org.sonar.batch.bootstrap.GlobalContainer.executeAnalysis(GlobalContainer.java:153)
○at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:110)
○at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:76)
○at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
○at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
○at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
○at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
○at java.lang.reflect.Method.invoke(Unknown Source)
○at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
○... 9 more
Caused by: java.lang.IllegalArgumentException: Unable to highlight file [moduleKey=A:A:843EAAC4-CD77-4A90-8261-34C358025BE8, relative=Content/Site.css, basedir=BLAH] from offset 10100 to offset 10136
○at org.sonar.api.batch.sensor.highlighting.internal.DefaultHighlighting.highlight(DefaultHighlighting.java:84)
○at org.sonar.batch.source.DefaultHighlightable$DefaultHighlightingBuilder.highlight(DefaultHighlightable.java:79)
○at org.sonar.css.ast.visitors.SyntaxHighlighterVisitor.visitToken(SyntaxHighlighterVisitor.java:109)
○at com.sonar.sslr.impl.ast.AstWalker.visitToken(AstWalker.java:107)
○at com.sonar.sslr.impl.ast.AstWalker.visit(AstWalker.java:86)
○at com.sonar.sslr.impl.ast.AstWalker.visitChildren(AstWalker.java:99)
○at com.sonar.sslr.impl.ast.AstWalker.visit(AstWalker.java:87)
○at com.sonar.sslr.impl.ast.AstWalker.walkAndVisit(AstWalker.java:69)
○at org.sonar.squidbridge.AstScanner.scanFiles(AstScanner.java:106)
○... 31 more
Caused by: java.lang.IllegalArgumentException: 10136 is not a valid offset for file [moduleKey=A:A:843EAAC4-CD77-4A90-8261-34C358025BE8, relative=Content/Site.css, basedir=BLAH]. Max offset is 10135
○at org.sonar.api.internal.google.common.base.Preconditions.checkArgument(Preconditions.java:148)
○at org.sonar.api.batch.fs.internal.DefaultInputFile.newPointer(DefaultInputFile.java:267)
○at org.sonar.api.batch.fs.internal.DefaultInputFile.newRange(DefaultInputFile.java:262)
○at org.sonar.api.batch.sensor.highlighting.internal.DefaultHighlighting.highlight(DefaultHighlighting.java:82)
○... 39 more

3 个答案:

答案 0 :(得分:2)

这实际上是SonarQube CSS插件中的一个错误,它试图突出显示文件中的无效偏移,而SonarQube 5.2则强制使偏移有效。

我已经在您发送Mike的Site.css文件中重现了该问题,并且可以将其最小化:似乎每当评论结束文件时都会出现此问题。

我在SonarQube CSS插件上提出了一个GitHub问题:https://github.com/SonarCommunity/sonar-css/issues/147

与此同时,您可以从分析中排除该文件,或卸载CSS插件,直到发布修复程序。

答案 1 :(得分:1)

可以在https://github.com/SonarQubeCommunity/sonar-css/releases/tag/1.7-RC1找到修复此问题的新版SonarQube CSS插件

答案 2 :(得分:0)

我遇到了同样的问题。

如果我在没有BOM的情况下以UTF-8编码保存了有问题的文件 - 这就解决了这个问题。