When I'm using PMD in SONAR the property "CloseTargets" DOESN'T WORK and I have some false positive. But when I'm using the property in PMD alone (with maven) IT WORKS.
here's my ruleset's configuration :
<properties>
<property name="types" value="Connection,Statement,ResultSet"/>
<property name="closeTargets" value="gbdd.fermer"/>
</properties>
the call to indirerctly close the connexion in the class targeted :
gbdd.fermer(resultSet);
and the method that really close the connexion :
public void fermer(final ResultSet resultSet) throws AccesBDDETException
{
if (resultSet != null)
{
try
{
resultSet.close();
}
...
Thanks a lot Nicolas for this notification ! I was finding myself this rule very useless without this hidden property.