2

使用 SonarQube 5.3 Findbugs 3.0.1 分析 Ant 项目得到以下堆栈跟踪:

[sonar:sonar] The following errors occurred during analysis: 
[sonar:sonar]   Can't get stack offset 0 from [] @ 271 in com.mypackage.MyClass.myMethod : (Lorg.apache.struts.action.ActionMapping;Lorg.apache.struts.action.ActionForm;Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)Lorg.apache.struts.action.ActionForward; 
[sonar:sonar]     java.lang.IllegalArgumentException: 0 is not a value stack offset 
[sonar:sonar]       At edu.umd.cs.findbugs.OpcodeStack.getStackItem(OpcodeStack.java:3100) 
[sonar:sonar]       At com.mebigfatguy.fbcontrib.detect.PossiblyRedundantMethodCalls.sawOpcode(PossiblyRedundantMethodCalls.java:289) 
[sonar:sonar]       At edu.umd.cs.findbugs.visitclass.DismantleBytecode.visit(DismantleBytecode.java:883) 
[sonar:sonar]       At edu.umd.cs.findbugs.visitclass.BetterVisitor.visitCode(BetterVisitor.java:218) 
[sonar:sonar]       At edu.umd.cs.findbugs.visitclass.PreorderVisitor.visitCode(PreorderVisitor.java:235) 
[sonar:sonar]       At com.mebigfatguy.fbcontrib.detect.PossiblyRedundantMethodCalls.visitCode(PossiblyRedundantMethodCalls.java:202) 
[sonar:sonar]       At org.apache.bcel.classfile.Code.accept(Code.java:135) 
[sonar:sonar]       At edu.umd.cs.findbugs.visitclass.PreorderVisitor.doVisitMethod(PreorderVisitor.java:307) 
[sonar:sonar]       At edu.umd.cs.findbugs.visitclass.PreorderVisitor.visitJavaClass(PreorderVisitor.java:395) 
[sonar:sonar]       At org.apache.bcel.classfile.JavaClass.accept(JavaClass.java:215) 
[sonar:sonar]       At edu.umd.cs.findbugs.BytecodeScanningDetector.visitClassContext(BytecodeScanningDetector.java:38) 
[sonar:sonar]       At com.mebigfatguy.fbcontrib.detect.PossiblyRedundantMethodCalls.visitClassContext(PossiblyRedundantMethodCalls.java:174) 
[sonar:sonar]       At edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:76) 
[sonar:sonar]       At edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1089) 
[sonar:sonar]       At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:283) 
[sonar:sonar]       At org.sonar.plugins.findbugs.FindbugsExecutor$FindbugsTask.call(FindbugsExecutor.java:211) 
[sonar:sonar]       At java.util.concurrent.FutureTask.run(FutureTask.java:262) 
[sonar:sonar]       At java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
[sonar:sonar]       At java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
[sonar:sonar]       At java.lang.Thread.run(Thread.java:745) 
[sonar:sonar]  
[sonar:sonar] 12:00:12.936 INFO  - Execute Findbugs 3.0.1 done: 59558 ms

SonarQube 5.1.1 没有发生此错误,我最近将版本更新到 5.3。

4

1 回答 1

0

请将您的插件Sonar-FindBugs更新到最新版本。stacktrace 中可见的 FindBugs 插件 FB-contrib 已更新至最新版本 6.6.1。

如果问题没有解决,您可以在这里报告问题:https ://github.com/mebigfatguy/fb-contrib/issues

于 2016-07-19T16:42:19.883 回答