Repository: commons-lang Updated Branches: refs/heads/master c3b38a3ba -> 6dc3a6db1
Replace FindBugs with SpotBugs Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/82fd2516 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/82fd2516 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/82fd2516 Branch: refs/heads/master Commit: 82fd2516d6c018e46ef290e05551349a9ed82ca8 Parents: 3ee9cc8 Author: pascalschumacher <pascalschumac...@gmx.net> Authored: Tue Aug 28 19:00:09 2018 +0200 Committer: pascalschumacher <pascalschumac...@gmx.net> Committed: Tue Aug 28 19:00:26 2018 +0200 ---------------------------------------------------------------------- findbugs-exclude-filter.xml | 153 --------------------------------------- pom.xml | 21 +++--- spotbugs-exclude-filter.xml | 153 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 163 insertions(+), 164 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/82fd2516/findbugs-exclude-filter.xml ---------------------------------------------------------------------- diff --git a/findbugs-exclude-filter.xml b/findbugs-exclude-filter.xml deleted file mode 100644 index 864b076..0000000 --- a/findbugs-exclude-filter.xml +++ /dev/null @@ -1,153 +0,0 @@ -<?xml version="1.0"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<!-- - This file contains some false positive bugs detected by findbugs. Their - false positive nature has been analyzed individually and they have been - put here to instruct findbugs it must ignore them. ---> -<FindBugsFilter> - - <!-- Reason: Optimization to use == --> - <Match> - <Class name="org.apache.commons.lang3.BooleanUtils" /> - <Or> - <Method name="toBoolean" /> - <Method name="toBooleanObject" /> - </Or> - <Bug pattern="ES_COMPARING_PARAMETER_STRING_WITH_EQ" /> - </Match> - <Match> - <Class name="org.apache.commons.lang3.BooleanUtils" /> - <Method name="toBoolean" /> - <Bug pattern="RC_REF_COMPARISON_BAD_PRACTICE_BOOLEAN" /> - </Match> - - <!-- Reason: Behavior documented in javadoc --> - <Match> - <Class name="org.apache.commons.lang3.BooleanUtils" /> - <Or> - <Method name="negate" /> - <Method name="toBooleanObject" /> - </Or> - <Bug pattern="NP_BOOLEAN_RETURN_NULL" /> - </Match> - - <!-- Reason: base class cannot be changed and field is properly checked against null so behavior is OK --> - <Match> - <Class name="org.apache.commons.lang3.text.ExtendedMessageFormat" /> - <Method name="applyPattern" /> - <Bug pattern="UR_UNINIT_READ_CALLED_FROM_SUPER_CONSTRUCTOR" /> - </Match> - - <!-- Reason: Optimization to use == --> - <Match> - <Class name="org.apache.commons.lang3.StringUtils" /> - <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> - - <!-- Reason: Very much intended to do a fall through on the switch --> - <Match> - <Class name="org.apache.commons.lang3.math.NumberUtils" /> - <Method name="createNumber"/> - <Bug pattern="SF_SWITCH_FALLTHROUGH" /> - </Match> - - <!-- Reason: Very much intended to do a fall through on the switch --> - <Match> - <Class name="org.apache.commons.lang3.time.DateUtils" /> - <Method name="getFragment"/> - <Bug pattern="SF_SWITCH_FALLTHROUGH" /> - </Match> - - <!-- Reason: toProperString is lazily loaded --> - <Match> - <Class name="org.apache.commons.lang3.math.Fraction" /> - <Field name="toProperString" /> - <Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED" /> - </Match> - - <!-- Reason: It does call super.clone(), but via a subsequent method --> - <Match> - <Class name="org.apache.commons.lang3.text.StrTokenizer" /> - <Method name="clone"/> - <Bug pattern="CN_IDIOM_NO_SUPER_CALL" /> - </Match> - - <!-- Reason: Testing shows that new Integer(...) etc is quicker than Integer.valueOf --> - <Match> - <Bug pattern="DM_NUMBER_CTOR" /> - </Match> - - <!-- Reason: FindBugs 2.0.2 used in maven-findbugs-plugin 2.5.2 seems to have problems with detection of default cases - in switch statements. All the excluded methods have switch statements that conatin a default case. --> - <Match> - <Class name="org.apache.commons.lang3.math.NumberUtils"/> - <Method name="createNumber" /> - <Bug pattern="SF_SWITCH_NO_DEFAULT" /> - </Match> - <Match> - <Class name="org.apache.commons.lang3.text.ExtendedMessageFormat"/> - <Method name="insertFormats" /> - <Bug pattern="SF_SWITCH_NO_DEFAULT" /> - </Match> - <!-- Reason: FindBugs does not correctly recognize default branches in switch statements without break statements. - See, e.g., the report at https://sourceforge.net/p/findbugs/bugs/1298 --> - <Match> - <Class name="org.apache.commons.lang3.time.FastDateParser"/> - <Or> - <Method name="getStrategy" /> - <Method name="simpleQuote" params="java.lang.StringBuilder, java.lang.String"/> - </Or> - <Bug pattern="SF_SWITCH_NO_DEFAULT" /> - </Match> - - <!-- Reason: FindBugs cannot correctly recognize default branches in switch statements without break statements. - See, e.g., the report at https://sourceforge.net/p/findbugs/bugs/1298 --> - <Match> - <Class name="org.apache.commons.lang3.time.FastDatePrinter"/> - <Method name="appendFullDigits" params="java.lang.Appendable, int, int"/> - <Bug pattern="SF_SWITCH_NO_DEFAULT" /> - </Match> - - <!-- Reason: The fallthrough on the swich statement is intentional --> - <Match> - <Class name="org.apache.commons.lang3.time.FastDatePrinter"/> - <Method name="appendFullDigits" params="java.lang.Appendable, int, int"/> - <Bug pattern="SF_SWITCH_FALLTHROUGH" /> - </Match> - - <!-- Reason: Internal class that is used only as a key for an internal FormatCache. For this reason we can - be sure, that equals will never be called with null or types other than MultipartKey. - --> - <Match> - <Class name="org.apache.commons.lang3.time.FormatCache$MultipartKey" /> - <Method name="equals" /> - <Bug pattern="BC_EQUALS_METHOD_SHOULD_WORK_FOR_ALL_OBJECTS" /> - </Match> - <Match> - <Class name="org.apache.commons.lang3.time.FormatCache$MultipartKey" /> - <Method name="equals" /> - <Bug pattern="NP_EQUALS_SHOULD_HANDLE_NULL_ARGUMENT" /> - </Match> -</FindBugsFilter> http://git-wip-us.apache.org/repos/asf/commons-lang/blob/82fd2516/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 149e151..add7075 100644 --- a/pom.xml +++ b/pom.xml @@ -589,6 +589,7 @@ <commons.encoding>utf-8</commons.encoding> <checkstyle.plugin.version>3.0.0</checkstyle.plugin.version> + <spotbugs.plugin.version>3.1.6</spotbugs.plugin.version> <japicmp.skip>false</japicmp.skip> <!-- JMH Benchmark related properties, version, target compiler and name of the benchmarking uber jar. --> @@ -611,7 +612,7 @@ <build> - <defaultGoal>clean verify apache-rat:check clirr:check checkstyle:check findbugs:check javadoc:javadoc</defaultGoal> + <defaultGoal>clean verify apache-rat:check clirr:check checkstyle:check spotbugs:check javadoc:javadoc</defaultGoal> <pluginManagement> <plugins> <plugin> @@ -703,12 +704,11 @@ </configuration> </plugin> <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>findbugs-maven-plugin</artifactId> - <!-- Use version from parent pom as that is adjusted according to the Java version used to run Maven --> - <version>${commons.findbugs.version}</version> + <groupId>com.github.spotbugs</groupId> + <artifactId>spotbugs-maven-plugin</artifactId> + <version>${spotbugs.plugin.version}</version> <configuration> - <excludeFilterFile>${basedir}/findbugs-exclude-filter.xml</excludeFilterFile> + <excludeFilterFile>${basedir}/spotbugs-exclude-filter.xml</excludeFilterFile> </configuration> </plugin> </plugins> @@ -735,12 +735,11 @@ </plugin> <!-- Requires setting 'export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m" ' --> <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>findbugs-maven-plugin</artifactId> - <!-- Use version from parent pom as that is adjusted according to the Java version used to run Maven --> - <version>${commons.findbugs.version}</version> + <groupId>com.github.spotbugs</groupId> + <artifactId>spotbugs-maven-plugin</artifactId> + <version>${spotbugs.plugin.version}</version> <configuration> - <excludeFilterFile>${basedir}/findbugs-exclude-filter.xml</excludeFilterFile> + <excludeFilterFile>${basedir}/spotbugs-exclude-filter.xml</excludeFilterFile> </configuration> </plugin> <plugin> http://git-wip-us.apache.org/repos/asf/commons-lang/blob/82fd2516/spotbugs-exclude-filter.xml ---------------------------------------------------------------------- diff --git a/spotbugs-exclude-filter.xml b/spotbugs-exclude-filter.xml new file mode 100644 index 0000000..864b076 --- /dev/null +++ b/spotbugs-exclude-filter.xml @@ -0,0 +1,153 @@ +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- + This file contains some false positive bugs detected by findbugs. Their + false positive nature has been analyzed individually and they have been + put here to instruct findbugs it must ignore them. +--> +<FindBugsFilter> + + <!-- Reason: Optimization to use == --> + <Match> + <Class name="org.apache.commons.lang3.BooleanUtils" /> + <Or> + <Method name="toBoolean" /> + <Method name="toBooleanObject" /> + </Or> + <Bug pattern="ES_COMPARING_PARAMETER_STRING_WITH_EQ" /> + </Match> + <Match> + <Class name="org.apache.commons.lang3.BooleanUtils" /> + <Method name="toBoolean" /> + <Bug pattern="RC_REF_COMPARISON_BAD_PRACTICE_BOOLEAN" /> + </Match> + + <!-- Reason: Behavior documented in javadoc --> + <Match> + <Class name="org.apache.commons.lang3.BooleanUtils" /> + <Or> + <Method name="negate" /> + <Method name="toBooleanObject" /> + </Or> + <Bug pattern="NP_BOOLEAN_RETURN_NULL" /> + </Match> + + <!-- Reason: base class cannot be changed and field is properly checked against null so behavior is OK --> + <Match> + <Class name="org.apache.commons.lang3.text.ExtendedMessageFormat" /> + <Method name="applyPattern" /> + <Bug pattern="UR_UNINIT_READ_CALLED_FROM_SUPER_CONSTRUCTOR" /> + </Match> + + <!-- Reason: Optimization to use == --> + <Match> + <Class name="org.apache.commons.lang3.StringUtils" /> + <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> + + <!-- Reason: Very much intended to do a fall through on the switch --> + <Match> + <Class name="org.apache.commons.lang3.math.NumberUtils" /> + <Method name="createNumber"/> + <Bug pattern="SF_SWITCH_FALLTHROUGH" /> + </Match> + + <!-- Reason: Very much intended to do a fall through on the switch --> + <Match> + <Class name="org.apache.commons.lang3.time.DateUtils" /> + <Method name="getFragment"/> + <Bug pattern="SF_SWITCH_FALLTHROUGH" /> + </Match> + + <!-- Reason: toProperString is lazily loaded --> + <Match> + <Class name="org.apache.commons.lang3.math.Fraction" /> + <Field name="toProperString" /> + <Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED" /> + </Match> + + <!-- Reason: It does call super.clone(), but via a subsequent method --> + <Match> + <Class name="org.apache.commons.lang3.text.StrTokenizer" /> + <Method name="clone"/> + <Bug pattern="CN_IDIOM_NO_SUPER_CALL" /> + </Match> + + <!-- Reason: Testing shows that new Integer(...) etc is quicker than Integer.valueOf --> + <Match> + <Bug pattern="DM_NUMBER_CTOR" /> + </Match> + + <!-- Reason: FindBugs 2.0.2 used in maven-findbugs-plugin 2.5.2 seems to have problems with detection of default cases + in switch statements. All the excluded methods have switch statements that conatin a default case. --> + <Match> + <Class name="org.apache.commons.lang3.math.NumberUtils"/> + <Method name="createNumber" /> + <Bug pattern="SF_SWITCH_NO_DEFAULT" /> + </Match> + <Match> + <Class name="org.apache.commons.lang3.text.ExtendedMessageFormat"/> + <Method name="insertFormats" /> + <Bug pattern="SF_SWITCH_NO_DEFAULT" /> + </Match> + <!-- Reason: FindBugs does not correctly recognize default branches in switch statements without break statements. + See, e.g., the report at https://sourceforge.net/p/findbugs/bugs/1298 --> + <Match> + <Class name="org.apache.commons.lang3.time.FastDateParser"/> + <Or> + <Method name="getStrategy" /> + <Method name="simpleQuote" params="java.lang.StringBuilder, java.lang.String"/> + </Or> + <Bug pattern="SF_SWITCH_NO_DEFAULT" /> + </Match> + + <!-- Reason: FindBugs cannot correctly recognize default branches in switch statements without break statements. + See, e.g., the report at https://sourceforge.net/p/findbugs/bugs/1298 --> + <Match> + <Class name="org.apache.commons.lang3.time.FastDatePrinter"/> + <Method name="appendFullDigits" params="java.lang.Appendable, int, int"/> + <Bug pattern="SF_SWITCH_NO_DEFAULT" /> + </Match> + + <!-- Reason: The fallthrough on the swich statement is intentional --> + <Match> + <Class name="org.apache.commons.lang3.time.FastDatePrinter"/> + <Method name="appendFullDigits" params="java.lang.Appendable, int, int"/> + <Bug pattern="SF_SWITCH_FALLTHROUGH" /> + </Match> + + <!-- Reason: Internal class that is used only as a key for an internal FormatCache. For this reason we can + be sure, that equals will never be called with null or types other than MultipartKey. + --> + <Match> + <Class name="org.apache.commons.lang3.time.FormatCache$MultipartKey" /> + <Method name="equals" /> + <Bug pattern="BC_EQUALS_METHOD_SHOULD_WORK_FOR_ALL_OBJECTS" /> + </Match> + <Match> + <Class name="org.apache.commons.lang3.time.FormatCache$MultipartKey" /> + <Method name="equals" /> + <Bug pattern="NP_EQUALS_SHOULD_HANDLE_NULL_ARGUMENT" /> + </Match> +</FindBugsFilter>