FindBugs exclude filter for StringUtils

Exclude ES_COMPARING_PARAMETER_STRING_WITH_EQ FindBugs warnings from
StringUtils methods compare(String, String, boolean) and
compareIgnoreCase(String, String, boolean).

The usages of the == operator seem to be intentional optimizations
similar to the usage in indexOfDifference. If this reasoning is ever
overruled, this suppression should be removed.
This commit is contained in:
Allon Mureinik 2017-04-01 11:44:39 +03:00 committed by pascalschumacher
parent 5a52446090
commit 3304965840
1 changed files with 5 additions and 1 deletions

View File

@ -58,7 +58,11 @@
<!-- Reason: Optimization to use == -->
<Match>
<Class name="org.apache.commons.lang3.StringUtils" />
<Method name="indexOfDifference"/>
<Or>
<Method name="indexOfDifference"/>
<Method name="compare" params="java.lang.String,java.lang.String,boolean"/>
<Method name="compareIgnoreCase" params="java.lang.String,java.lang.String,boolean"/>
</Or>
<Bug pattern="ES_COMPARING_PARAMETER_STRING_WITH_EQ" />
</Match>