commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject [11/50] [lang] FindBugs exclude filter for StringUtils
Date Wed, 17 May 2017 15:03:55 GMT
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/release
Commit: 3304965840c139dae7b8c01e1779a806641a0159
Parents: 5a52446
Author: Allon Mureinik <amureini@redhat.com>
Authored: Sat Apr 1 11:44:39 2017 +0300
Committer: pascalschumacher <pascalschumacher@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>
 


Mime
View raw message