使用 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。