Findbugs does not exclude methods in our Java application

I added the following to the exclude.xml findbugs file

<Match> <Class name="com.ebay.kernel.service.invocation.SvcInvocationConfig" /> <Method name="getConnectionConfig" /> <Bug pattern="IS2_INCONSISTENT_SYNC" /> </Match> 

Code to ignore

 public ConnectionConfig getConnectionConfig() { return m_connectionConfig; } 

because Findbugs reports that

 m_connectionConfig suffers from (inconsistent synchronization) BUG - IS2_INCONSISTENT_SYNC 

But for some reason my findbugs are not ignored.

and when I do the following -

 <Match> <Class name="com.ebay.kernel.service.invocation.SvcInvocationConfig" /> <Bug pattern="IS2_INCONSISTENT_SYNC" /> </Match> 

Search errors are ignored for the whole class, but as soon as I submit

 <Method name="getConnectionConfig"> 

the tag between them, findbugs is no longer ignored for this method.

Can someone help me understand why?

+8
java findbugs
source share
1 answer

The IS2_INCONSISTENT_SYNC warning is issued in the data field (field) in accordance with its customs in various ways, constructors, static blocks, etc., and not with the method itself, so you cannot ignore it with <Method> .

Instead, you can use the <Field> element:

 <Match> <Class name="com.ebay.kernel.service.invocation.SvcInvocationConfig" /> <Field name="m_connectionConfig" /> <Bug pattern="IS2_INCONSISTENT_SYNC" /> </Match> 
+3
source share

All Articles