Search code examples
javamaven-3devopsspotbugsfind-sec-bugs

How to mark false positive in spotbug report


I went through the documentation of spotbug https://spotbugs.readthedocs.io/en/stable/

However information on false positive is not comprehensive.

Kindly help me with the steps to mark certain bug reported as false positive and so that those are not part of the report anymore.

P.S. - SuppressFBWarnings cannot be used in our case.


Solution

  • Thanks Ole. The XML file is like this and one has to add the filename in the of spotbugs maven plugin in pom file:

    <?xml version="1.0" encoding="UTF-8"?>
    <FindBugsFilter>
      <Match>
        <Class name="com.foobar.MyClass" />
        <Method name="someMethod" />
        <Bug pattern="DLS_DEAD_LOCAL_STORE" />
        <Priority value="2" />
      </Match>
    </FindBugsFilter>