运行Sonar Runner时的NPE

时间:2015-03-30 11:04:21

标签: sonar-runner sonarqube-5.0

当针对SonarQube 5.1 RC2运行Sonar Runner 2.4时出现此错误:

ERROR: Error during Sonar runner execution
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: java.lang.NullPointerException
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:98)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
at sun.nio.fs.AbstractPath.resolve(AbstractPath.java:53)
at org.sonar.api.batch.fs.internal.DefaultInputFile.path(DefaultInputFile.java:72)
at org.sonar.api.batch.fs.internal.DefaultInputFile.file(DefaultInputFile.java:64)
at org.sonar.api.batch.fs.internal.PathPattern$RelativePathPattern.match(PathPattern.java:101)
at org.sonar.batch.scan.filesystem.LanguageDetection.isCandidateForLanguage(LanguageDetection.java:124)
at org.sonar.batch.scan.filesystem.LanguageDetection.language(LanguageDetection.java:97)
at org.sonar.batch.scan.filesystem.InputFileBuilder.completeAndComputeMetadata(InputFileBuilder.java:100)
at org.sonar.batch.scan.filesystem.FileIndexer$1.call(FileIndexer.java:157)
at org.sonar.batch.scan.filesystem.FileIndexer$1.call(FileIndexer.java:154)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Process exited with code 1
Step Start SonarQube Code Analysis (Command Line) failed

同样适用于SonarQube 5.0.1。

也许一些防御性编程在Sonar Runner中会很好。 NPE不会告诉用户任何有意义的内容。我建议它们包含一个断言,如果存在输出有用的异常消息的问题。

1 个答案:

答案 0 :(得分:0)

很可能是某些声纳属性预期目录是用包含“..”的东西定义的。不幸的是,在我的测试中,声纳期待绝对的道路。我在sonar-ant-runner中遇到了sonar.sources,sonar.java.binaries和sonar.projectBaseDir属性的问题。