commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [commons-io] branch master updated: Tidy up spotbugs exclude filter
Date Sat, 08 Aug 2020 20:51:37 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new c8d04ca  Tidy up spotbugs exclude filter
c8d04ca is described below

commit c8d04cabb3d4286cdee55d9383acfb221ddb87c3
Author: Sebb <sebb@apache.org>
AuthorDate: Sat Aug 8 21:51:29 2020 +0100

    Tidy up spotbugs exclude filter
---
 findbugs-exclude-filter.xml                    | 95 --------------------------
 pom.xml                                        |  4 +-
 sb-excludes.xml => spotbugs-exclude-filter.xml | 19 ++++++
 3 files changed, 21 insertions(+), 97 deletions(-)

diff --git a/findbugs-exclude-filter.xml b/findbugs-exclude-filter.xml
deleted file mode 100644
index 506146a..0000000
--- a/findbugs-exclude-filter.xml
+++ /dev/null
@@ -1,95 +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>
-
-
-  <!--  See discussion on https://issues.apache.org/jira/browse/IO-215 -->
-  <Match>
-    <Class name="org.apache.commons.io.FileUtils" />
-    <Or>
-      <Method name="doCopyDirectory" params="java.io.File,java.io.File,java.io.FileFilter,boolean,java.util.List"
returns="void" />
-      <Method name="doCopyFile" params="java.io.File,java.io.File,boolean" returns="void"
/>
-    </Or>
-    <Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE" />
-  </Match>
-
-
-  <!--
-       Ignoring the return from mkdirs() is a false positives since the
-       following line in both those methods checks for the existence of
-       the directory and throws an exception if it doesn't exist. 
-    -->
-  <Match>
-    <Class name="org.apache.commons.io.FileUtils" />
-    <Or>
-      <Method name="moveDirectoryToDirectory" params="java.io.File,java.io.File,boolean"
returns="void" />
-      <Method name="moveFileToDirectory" params="java.io.File,java.io.File,boolean" returns="void"
/>
-    </Or>
-    <Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE" />
-  </Match>
-
-
-  <!--
-      FileEntry is used internally by FileAlterationObserver to refresh and
-      update the state of files it is monitoring and in that context this is
-      not an issue. If people re-use it elsewhere then they need to
-      take care - but its not its primary purpose here and so its OK
-    -->
-  <Match>
-    <Class name="org.apache.commons.io.monitor.FileEntry" />
-    <Method name="setChildren" params="org.apache.commons.io.monitor.FileEntry[]" returns="void"
/>
-    <Bug pattern="EI_EXPOSE_REP2" />
-  </Match>
-
-
-  <!--  See discussion on https://issues.apache.org/jira/browse/IO-214 -->
-  <Match>
-    <Class name="org.apache.commons.io.output.ByteArrayOutputStream" />
-    <Bug pattern="IS2_INCONSISTENT_SYNC" />
-  </Match>
-
-
-  <!-- This is a false positive since close() does nothing in the Stream implementation
being used -->
-  <Match>
-    <Class name="org.apache.commons.io.output.ByteArrayOutputStream" />
-    <Method name="toBufferedInputStream" params="java.io.InputStream" returns="java.io.InputStream"
/>
-    <Bug pattern="OS_OPEN_STREAM" />
-  </Match>
-
-
-  <!--  See discussion on https://issues.apache.org/jira/browse/IO-216 -->
-  <Match>
-    <Class name="org.apache.commons.io.output.LockableFileWriter" />
-    <Method name="close" params="" returns="void" />
-    <Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE" />
-  </Match>
-
-  <Match>
-    <Class name="org.apache.commons.io.output.DeferredFileOutputStream" />
-    <Or>
-      <Method name="thresholdReached" params="" returns="void" />
-    </Or>
-    <Bug pattern="OBL_UNSATISFIED_OBLIGATION" />
-  </Match>
-</FindBugsFilter>
diff --git a/pom.xml b/pom.xml
index fce75b7..5df47b8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -403,7 +403,7 @@ file comparators, endian transformation classes, and much more.
          </dependency>
         </dependencies>
         <configuration>
-          <excludeFilterFile>${basedir}/sb-excludes.xml</excludeFilterFile>
+          <excludeFilterFile>${basedir}/spotbugs-exclude-filter.xml</excludeFilterFile>
         </configuration>
       </plugin>
     </plugins>
@@ -425,7 +425,7 @@ file comparators, endian transformation classes, and much more.
         <artifactId>spotbugs-maven-plugin</artifactId>
         <version>${spotbugs.plugin.version}</version>
         <configuration>
-          <excludeFilterFile>${basedir}/sb-excludes.xml</excludeFilterFile>
+          <excludeFilterFile>${basedir}/spotbugs-exclude-filter.xml</excludeFilterFile>
         </configuration>
       </plugin>
     </plugins>
diff --git a/sb-excludes.xml b/spotbugs-exclude-filter.xml
similarity index 54%
rename from sb-excludes.xml
rename to spotbugs-exclude-filter.xml
index c2a255c..b1a7df5 100644
--- a/sb-excludes.xml
+++ b/spotbugs-exclude-filter.xml
@@ -17,5 +17,24 @@
 -->
 <FindBugsFilter>
 
+  <!--  See discussion on https://issues.apache.org/jira/browse/IO-216 -->
+  <Match>
+    <Class name="org.apache.commons.io.output.LockableFileWriter" />
+    <Method name="close" params="" returns="void" />
+    <Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE" />
+  </Match>
+
+  <!-- The constructors intentionally do not copy the input byte array -->
+  <Match>
+    <Class name="org.apache.commons.io.input.UnsynchronizedByteArrayInputStream" />
+    <Method name="&lt;init&gt;" />
+    <Bug pattern="EI_EXPOSE_REP2" />
+  </Match>
+
+  <!-- The encoding is irrelevant as output is binned -->
+  <Match>
+    <Class name="org.apache.commons.io.output.NullPrintStream" />
+    <Bug pattern="DM_DEFAULT_ENCODING" />
+  </Match>
 
 </FindBugsFilter>


Mime
View raw message