pvgoddijn
pvgoddijn

Reputation: 12898

Findbugs java result: 137 static analysis plugin

We are running a findbug job on jenkins after each commit, the results of which a published by the static analysis plugin. This normally works completely as expected, However from time to time (about once every 100 builds) findbugs exits with exit code 137. When it does this is also generates a completely empty findbugs.xml file

The empty xml file causes the static analysis plugin to think this build was really awesome (no bugs) and uses this as a new reference build, which in turn makes every build afterwards failed / unstable.

I cant really find anything usefull regarding what this exit code should mean, or how to prevent it. I'm looking for a way to either prevent the occurrence of this exitcode 137 or get the static analysis plugin to treat this build as a failure (instead of a new reference build)

I'd also like to know what this code actualy means.

Console output of the job with exitcode 137 (job: #1957, reports no bugs)

--- snip -- more applying of bugpatterns--
[findbugs] Applying edu.umd.cs.findbugs.detect.MultithreadedInstanceAccess to nl/base/rela/entities/relagroups/RelationGroup$1
 [findbugs] Applying edu.umd.cs.findbugs.detect.BadUseOfReturnValue to nl/base/rela/entities/relagroups/RelationGroup$1
 [findbugs] Applying edu.umd.cs.findbugs.detect.MethodReturnCheck to nl/base/rela/entities/relagroups/RelationGroup$1
 [findbugs] Applying edu.umd.cs.findbugs.detect.IDivResultCastToDouble to nl/base/rela/entities/relagroups/RelationGroup$1
 [findbugs] Applying edu.umd.cs.findbugs.detect.FindBadCast2 to nl/base/rela/entities/relagroups/RelationGroup$1
 [findbugs] Java Result: 137
 [findbugs] Output saved to findbugs.xml

BUILD SUCCESSFUL
Total time: 9 minutes 0 seconds
[FINDBUGS] Collecting findbugs analysis files...
[FINDBUGS] Finding all files that match the pattern trunk/findbugs.xml
[FINDBUGS] Parsing 1 files in /data/hudson/workspace/crm-findbugs
[FINDBUGS] Skipping file  of module /data/hudson/workspace/crm-findbugs/trunk/findbugs.xml because it's empty.
[FINDBUGS] Computing warning deltas based on reference build #1956
[ANALYSIS-COLLECTOR] Computing warning deltas based on reference build #1956
Archiving artifacts

console output of the previous job (job: #1956, reports existing bugs):

     ---snip---
 [findbugs] Applying edu.umd.cs.findbugs.detect.AtomicityProblem to nl/base/rela/entities/Project$1
 [findbugs] Applying edu.umd.cs.findbugs.detect.DefaultEncodingDetector to nl/base/rela/entities/Project$1
 [findbugs]       32 usecs/byte      29 msec     898 bytes  1 pass nl/base/rela/entities/Project$1
 [findbugs] Analysis completed
 [findbugs] Warnings generated: 770
 [findbugs] Calculating exit code...
 [findbugs] Setting 'bugs found' flag (1)
 [findbugs] Exit code set to: 1
 [findbugs] Java Result: 1
 [findbugs] Output saved to findbugs.xml

BUILD SUCCESSFUL
Total time: 9 minutes 30 seconds
[FINDBUGS] Collecting findbugs analysis files...
[FINDBUGS] Finding all files that match the pattern trunk/findbugs.xml
[FINDBUGS] Parsing 1 files in /data/hudson/workspace/crm-findbugs
[FINDBUGS] Successfully parsed file /data/hudson/workspace/crm-findbugs/trunk/findbugs.xml of module  with 770 warnings.
[FINDBUGS] Computing warning deltas based on reference build #1955
[ANALYSIS-COLLECTOR] Computing warning deltas based on reference build #1955
Archiving artifacts

Upvotes: 3

Views: 1724

Answers (1)

hyde
hyde

Reputation: 62787

  1. As workaround, add buld step which runs script which checks if that findbugs.xml file is empty, and returns non-zero exit code if it is, failing the build

  2. File a bug report aginst the Jenkins plugin at https://issues.jenkins-ci.org

  3. Optional: check out the plugin, fix it yourself, submit patch

Upvotes: 2

Related Questions