You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by th...@apache.org on 2019/12/29 06:08:03 UTC

[commons-dbutils] 03/09: Change from findbugs to spotbugs since findbugs is no longer maintained Add spotbugs exclusions for false positives

This is an automated email from the ASF dual-hosted git repository.

thecarlhall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-dbutils.git

commit eda6b4aad35621cbfa93d120dab26494da14ed2d
Author: Carl Hall <th...@apache.org>
AuthorDate: Fri Dec 27 22:13:47 2019 -0800

    Change from findbugs to spotbugs since findbugs is no longer maintained
    Add spotbugs exclusions for false positives
---
 pom.xml         | 26 +++++++++++++++++---------
 sb-excludes.xml | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 9 deletions(-)

diff --git a/pom.xml b/pom.xml
index 02e6407..7d01207 100644
--- a/pom.xml
+++ b/pom.xml
@@ -238,7 +238,8 @@
     <maven.compiler.source>1.7</maven.compiler.source>
     <maven.compiler.target>1.7</maven.compiler.target>
 
-    <checkstyle.version>8.27</checkstyle.version>
+    <dbutils.spotbugs.version>3.1.12</dbutils.spotbugs.version>
+    <dbutils.checkstyle.version>8.27</dbutils.checkstyle.version>
 
     <commons.componentid>dbutils</commons.componentid>
     <commons.module.name>org.apache.commons.dbutils</commons.module.name>
@@ -252,7 +253,7 @@
   </properties>
 
   <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>
@@ -269,10 +270,20 @@
             <dependency>
               <groupId>com.puppycrawl.tools</groupId>
               <artifactId>checkstyle</artifactId>
-              <version>${checkstyle.version}</version>
+              <version>${dbutils.checkstyle.version}</version>
             </dependency>
           </dependencies>
         </plugin>
+        <plugin>
+          <groupId>com.github.spotbugs</groupId>
+          <artifactId>spotbugs-maven-plugin</artifactId>
+          <version>${dbutils.spotbugs.version}</version>
+          <configuration>
+            <threshold>Normal</threshold>
+            <effort>Default</effort>
+            <excludeFilterFile>sb-excludes.xml</excludeFilterFile>
+          </configuration>
+        </plugin>
       </plugins>
     </pluginManagement>
     <plugins>
@@ -345,16 +356,13 @@
         <artifactId>maven-checkstyle-plugin</artifactId>
       </plugin>
       <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>findbugs-maven-plugin</artifactId>
-        <configuration>
-          <threshold>Normal</threshold>
-          <effort>Default</effort>
-        </configuration>
+        <groupId>com.github.spotbugs</groupId>
+        <artifactId>spotbugs-maven-plugin</artifactId>
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-pmd-plugin</artifactId>
+        <version>${commons.pmd.version}</version>
         <configuration>
           <targetJdk>${maven.compiler.source}</targetJdk>
           <rulesets>
diff --git a/sb-excludes.xml b/sb-excludes.xml
new file mode 100644
index 0000000..290a7c7
--- /dev/null
+++ b/sb-excludes.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   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.
+-->
+<FindBugsFilter>
+    <!-- PrintWriter wraps System.err which always uses the default encoding -->
+    <Match>
+        <Class name="org.apache.commons.dbutils.DbUtils" />
+        <Method name="printStackTrace" />
+        <Bug pattern="DM_DEFAULT_ENCODING" />
+    </Match>
+    <!-- PrintWriter wraps System.err which always uses the default encoding -->
+    <Match>
+        <Class name="org.apache.commons.dbutils.DbUtils" />
+        <Method name="printWarnings" />
+        <Bug pattern="DM_DEFAULT_ENCODING" />
+    </Match>
+    <!-- The javadocs state and the called code shows that null can be returned. -->
+    <Match>
+        <Class name="org.apache.commons.dbutils.QueryLoader" />
+        <Method name="loadQueries" />
+        <Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE" />
+    </Match>
+</FindBugsFilter>
\ No newline at end of file