XML Report Processor - Findbugs configuration for Findbugs home and monitoring rules

Hello,

I  am having some trouble getting the Findbugs XML report processor  working as needed. Essentially, what I want to do is to get TeamCity  Findbugs reporting to line up with our Ant command line build.

We  are using Findbugs 2.0.0 and we have an include.xml file outlining the  bugs that we want to check for and an exclude.xml outlining the  exclusions to our global bug checking.

The include.xml file looks something like:

<FindBugsFilter>
    <Match>
        <Or>
            <Bug pattern="AM_CREATES_EMPTY_JAR_FILE_ENTRY"/>
            <Bug pattern="AM_CREATES_EMPTY_ZIP_FILE_ENTRY"/>
            <Bug pattern="BC_EQUALS_METHOD_SHOULD_WORK_FOR_ALL_OBJECTS"/>
            .....
        </Or>
   </Match>
</FindBugsFilter>

And the exclude.xml file looks something like:

FindBugsFilter>
    <!-- See http://findbugs.sourceforge.net/manual/filter.html for how to extend this file -->

    <!-- Ignore generated tmf classes -->
    <Match>
        <Package name="~com\.tmf.*"/>
    </Match>
    ....
</FindBugsFilter>

Now, I have added an XML report processing build feature to my Ant build in TeamCity and configured things as follows:

Report Type - FindBugs
FindBugs home path - <absolute path to FindBugs installation> eg. /export/home/teamcity/findbugs-2.0.0
Monitoring Rules:
artifacts/findbugs/Aggregate-Findbugs-Report.xml
+|-:<path to file>/findbugs-include-filters.xml
+|-:<path to file>/findbugs-exclude-filters.xml

Note - I have omitted the "path to file" above for simplicity.

I  was a little unclear as to the syntax of the monitoring rules section. I  wasn't sure if things should be +: for include and -: for exlcude. I  have tried various combinations and nothing seems to work.

My Build Log file produces the following:

[15:34:44]: FindBugs report watcher
[15:34:44]: [FindBugs report watcher] 1 report found for paths:
[15:34:44]: [FindBugs report watcher] artifacts/findbugs/Aggregate-Findbugs-Report.xml
[15:34:44]: [FindBugs report watcher]  +|-:<path to file>/findbugs-include-filters.xml
[15:34:44]: [FindBugs report watcher]  +|-:<path to file>/findbugs-exclude-filters.xml
[15:34:44]: [FindBugs report watcher] Successfully parsed
[15:34:44]: [Successfully parsed] 1 report
[15:34:44]: [Successfully parsed] artifacts/findbugs/Aggregate-Findbugs-Report.xml
[15:34:44]: Publishing internal artifacts
[15:34:45]: [Publishing internal artifacts] Sending build.finish.properties file
[15:34:44]: Publishing artifacts (2s)
[15:34:44]: [Publishing artifacts] Paths to publish: [artifacts]
[15:34:45]: [Publishing artifacts] Sending files
[15:34:48]: Build finished
[15:34:48]: Total: 1594 (+0 -0) Errors: 194 (+0 -0)

At  the end of the day, the number of Errors does not match the number of  Priority 1 issues in the XML report and the total is out of sync as  well.

I am running TeamCity 6.5.3 (build 17985).

Any guidance or help would be appreciated.

Thanks,
-Tim

12 comments
Comment actions Permalink

Hello, Tim,

Xml report processing is designed in such a way that it reports all the inspections detected in report files, so any kind of filtering can be achieved by configuring Findbugs.
Monitoring rules are designed for easy providing paths to the reports, e.g. if you want to report inspections from all *-Report.xml files in artifacts/findbugs build checkout directory subfolder you specify:i

Monitoring Rules:
+:artifacts/findbugs/*-Report.xml (+: may be omitted)

If you want to report inspections from all *-Report.xml except Some-Report.xml you specify:


Monitoring Rules:
+:artifacts/findbugs/*-Report.xml
-:artifacts/findbugs/Some-Report.xml

Please try configuring your reporting properly and let me know if you still face the issue.

0
Comment actions Permalink

Thanks so much for getting back to me. I was kind of grasping at straws trying to get this to work properly. My initial expectation was that you use the include/exclude filter files from the Ant command line to produce the xml output file so in theory you should not need to provide these include/exclude files to the TeamCity Report processor.

The way you suggest to set things up below is how we had set things up originally. Essentially just pointing the XML report processor to the XML ouput from our Findbugs command line tool.

I noticed that you bundle version 1.3.9 of Findbugs in your plugin after digging through the source from - http://svn.jetbrains.org/teamcity/plugins/xml-tests-reporting/branches/Eluru-6.5.x/.

So, pointing to version 2.0.0 in the XML report processing config would be ideal from a bug definition loading perspective ... as there are probably new bugs in 2.0 that are not in 1.3.9.

But my fundamental problem ... is why do the number of errors (Priority 1 issues) in the xml report not match up with the TeamCity build status and the data in the Code Inspection tab? We have 260 Priority 1 issues in our xml report and 192 errors reported in the build status and the Code Inspection tab.

One of the big benefits of the TeamCity XML report processor is deltas. What are the new bugs between build X and build Y. That is the feature I want to really take advantage of for developers so they can see what bugs they introduced as part of their check-in and then go off and fix them.

Any ideas as to why these two numbers don't line up? Does the XML processor plug-in do any grouping of bugs logically or is it just a simple XML reader?

Any insight would be appreciated.

Thanks again,
-Tim

0
Comment actions Permalink

A little more follow up. Here are some more details from our build log file:

[10:38:42]: FindBugs report watcher
[10:38:42]: [FindBugs report watcher] Watching paths:
[10:38:42]: [FindBugs report watcher] artifacts/findbugs/Aggregate-Findbugs-Report.xml
....
[10:38:45]: [mkdir] Created dir: /localocbuilds/agent/work/edc8766f4d88716f/artifacts/findbugs
....
[10:54:19]: [antcall] publish_findbugs
[10:54:19]: [publish_findbugs] copy
[10:54:19]: [copy] Copying 2 files to /localocbuilds/agent/work/edc8766f4d88716f/artifacts/findbugs
** Note - this is our own xml processor that we inserted to count bugs in our debugging efforts. These numbers match the XML report #s.

[10:54:19]: [publish_findbugs] exec
[10:54:19]: [exec] ##teamcity[buildStatisticValue key='HIGH' value='260']
[10:54:19]: [exec] ##teamcity[buildStatisticValue key='MEDIUM' value='900']
[10:54:19]: [exec] ##teamcity[buildStatisticValue key='LOW' value='1108']
[10:54:19]: [exec] ##teamcity[buildStatisticValue key='TOTAL_BUGS' value='2268']
[10:54:19]: [exec] HIGH=260
[10:54:19]: [exec] MEDIUM=900
[10:54:19]: [exec] LOW=1108
[10:54:19]: [exec] TOTAL_BUGS=2268
....
/localocbuilds/agent/work/edc8766f4d88716f/artifacts/findbugs/Aggregate-Findbugs-Report.xml  report processed: 269 errors, 932 warnings, 1196 info messages
....
FindBugs report watcher
[10:54:58]: [FindBugs report watcher] 1 report found for paths:
[10:54:58]: [FindBugs report watcher] artifacts/findbugs/Aggregate-Findbugs-Report.xml
[10:54:58]: [FindBugs report watcher] Successfully parsed
[10:54:58]: [Successfully parsed] 1 report
[10:54:58]: [Successfully parsed] artifacts/findbugs/Aggregate-Findbugs-Report.xml
[10:54:58]: Publishing internal artifacts
[10:54:58]: [Publishing internal artifacts] Sending build.finish.properties file
[10:54:58]: Publishing artifacts (1s)
[10:54:58]: [Publishing artifacts] Paths to publish: [artifacts]
[10:54:58]: [Publishing artifacts] Sending files
[10:55:00]: Build finished
[10:55:00]: Total: 1589 (+0 -0) Errors: 192 (+0 -0)



You can see the flow of things here. Our own XML counter seems to count things correctly - HIGH(Priority 1 or Errors)=260, MEDIUM(Priority 2 or Warnings)=900, LOW(Priority 3 or Info)=1108. Then the TeamCity XML report processor counts 269 errors, 932 warnings and 1196 infos. My suspicion here is part of the delta can be accounted for by the "Another occurrence" instances in the XML report where multiple instances of the same Bug in the same class are reported as one bug. We have seen this same behaviour with the Eclipse Findbugs plug-in.



But then mysteriously, the numbers at the end are 1589 Inspections (which I'm not exactly sure what an Inpsection is) and 192 Errors. And the Code Inpsection tab matches these numbers. I would expect the total # of errors to be 269 as counted by the TeamCity plug-in earlier.


-Tim




0
Comment actions Permalink

Tim,

I noticed that you bundle version 1.3.9 of Findbugs in your plugin after digging through the source from - http://svn.jetbrains.org/teamcity/plugins/xml-tests-reporting/branches/Eluru-6.5.x/.

So, pointing to version 2.0.0 in the XML report processing config would be ideal from a bug definition loading perspective ... as there are probably new bugs in 2.0 that are not in 1.3.9.

Thanks for pointing this out. We actually ask plugin users for Findbug home path setting and use bug pattern definitions from the provided tool. Bundled 1.3.9 patterns are used only if Findbugs home path is left blank or if some invalid path is provided, in this case you get warning in build log. Probably we'll make this setting mandatory in future.

Due to your initial problem - could you please file an issue in our bug tracker http://youtrack.jetbrains.com/issues/TW with a link to this thread and let's move the discussion there.
Please attach your XML report to the issue or send it to teamcity-feedback@jetbrains.com with a link to the issue.

0
Comment actions Permalink

TW-21817 created and Findbugs xml report e-mailed to address specified.

Reading other forum entries ... it seems that other folks have experienced similar issues. Are there available builds for this plug-in that may fix some of these issues?

Thanks,
-Tim

0
Comment actions Permalink

Tim,

Seems that you're facing http://youtrack.jetbrains.com/issue/TW-18032, which was fixed in TeamCity 6.5.4 and in TeamCity 7.0
Are you intending to upgrade TeamCity in the nearest future?

0
Comment actions Permalink

I'll check with our TC admin to see if we can upgrade to 6.5.4 in the near future.

Thanks for all the help.

-Tim

0
Comment actions Permalink

Time,
If you are not going to upgrade in a while, I can provide you with plugin build containig the fix.

0
Comment actions Permalink

If that is an option, that would be much appreciated. And any pointers for patching the plug-in would be appreciated as well.

-Tim

0
Comment actions Permalink

Tim,
I've attached xml-report-plugin.zip.
To upgrade the plugin please put xml-report-plugin.zip to TeamCity data directory (.BuildServer/plugins) and restart TeamCity server.



Attachment(s):
xml-report-plugin.zip
0
Comment actions Permalink

We updated the plug-in during our most recent maintenance window and we are seeing the following Exception during FindBugs report processing:

[14:59:57]: Unexpected  exception occurred while parsing  /localocbuilds/agent/work/edc8766f4d88716f/artifacts/findbugs/Aggregate-Findbugs-Report.xml
[14:59:57]: java.lang.NoSuchMethodError: jetbrains.buildServer.util.XmlXppAbstractParser$XmlElementInfo.getLocalName()Ljava/lang/String; java.lang.NoSuchMethodError: jetbrains.buildServer.util.XmlXppAbstractParser$XmlElementInfo.getLocalName()Ljava/lang/String;      at  jetbrains.buildServer.xmlReportPlugin.parsers.findBugs.FindBugsReportXmlParser$1$2$4.processElement(FindBugsReportXmlParser.java:97)      at jetbrains.buildServer.util.XmlXppAbstractParser$8.processElement(XmlXppAbstractParser.java:344)      at jetbrains.buildServer.util.XmlXppAbstractParser$5.startElement(XmlXppAbstractParser.java:175)      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)      at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)      at  com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755)      at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)      at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)      at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)      at jetbrains.buildServer.util.XmlXppAbstractParser.parseWithSAX(XmlXppAbstractParser.java:228)      at jetbrains.buildServer.util.XmlXppAbstractParser.parse(XmlXppAbstractParser.java:39)      at jetbrains.buildServer.xmlReportPlugin.parsers.findBugs.FindBugsReportParser.parse(FindBugsReportParser.java:153)      at jetbrains.buildServer.xmlReportPlugin.ParseReportCommand.run(ParseReportCommand.java:64)      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)      at java.util.concurrent.FutureTask.run(FutureTask.java:138)      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)      at java.lang.Thread.run(Thread.java:662)


Any ideas how we can work around this issue?


Thanks,
-Tim
0
Comment actions Permalink

Hello, Tim,

Seems that server and plugin versions are not synchronized.

What TeamCity version are you running now?
Do you have xml-report-plugin.zip in .BuildServer/plugins?
Could you please attach teamcity-server.log/

0

Please sign in to leave a comment.