You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by pa...@apache.org on 2017/04/19 16:25:37 UTC

[2/6] [lang] FindBugs exclude filter for StringUtils

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.


Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/33049658
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/33049658
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/33049658

Branch: refs/heads/master
Commit: 3304965840c139dae7b8c01e1779a806641a0159
Parents: 5a52446
Author: Allon Mureinik <am...@redhat.com>
Authored: Sat Apr 1 11:44:39 2017 +0300
Committer: pascalschumacher <pa...@gmx.net>
Committed: Wed Apr 19 18:24:57 2017 +0200

----------------------------------------------------------------------
 findbugs-exclude-filter.xml | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/33049658/findbugs-exclude-filter.xml
----------------------------------------------------------------------
diff --git a/findbugs-exclude-filter.xml b/findbugs-exclude-filter.xml
index def3ec8..f7623df 100644
--- a/findbugs-exclude-filter.xml
+++ b/findbugs-exclude-filter.xml
@@ -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>