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

ggregory 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 05e745f7 Fix SpotBugs error
05e745f7 is described below

commit 05e745f77e57475832c3fdc3520ee14dfb9412d2
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Thu Nov 23 12:03:58 2023 -0500

    Fix SpotBugs error
    
    [ERROR] Medium:
    org.apache.commons.io.FileCleaningTracker.getDeleteFailures() may expose
    internal representation by returning FileCleaningTracker.deleteFailures
    [org.apache.commons.io.FileCleaningTracker] At
    FileCleaningTracker.java:[line 218] EI_EXPOSE_REP
---
 src/changes/changes.xml                                      | 1 +
 src/main/java/org/apache/commons/io/FileCleaningTracker.java | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 741fd2d9..24b75e50 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -61,6 +61,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action dev="ggregory" type="fix" due-to="Gary Gregory">Fix SpotBugs 
error: org.apache.commons.io.function.IOStream$1.next() cannot throw 
NoSuchElementException [org.apache.commons.io.function.IOStream$1] At 
IOStream.java:[line 98] IT_NO_SUCH_ELEMENT.</action>
       <action dev="ggregory" type="fix" due-to="Gary Gregory">Fix SpotBugs 
error: Class org.apache.commons.io.monitor.FileAlterationObserver defines 
non-transient non-serializable instance field fileFilter 
[org.apache.commons.io.monitor.FileAlterationObserver] In 
FileAlterationObserver.java SE_BAD_FIELD.</action>
       <action dev="ggregory" type="fix" due-to="Gary Gregory">Fix SpotBugs 
error: Class org.apache.commons.io.monitor.FileAlterationObserver defines 
non-transient non-serializable instance field listeners 
[org.apache.commons.io.monitor.FileAlterationObserver] In 
FileAlterationObserver.java SE_BAD_FIELD.</action>
+      <action dev="ggregory" type="fix" due-to="Gary Gregory">Fix SpotBugs 
error: org.apache.commons.io.FileCleaningTracker.getDeleteFailures() may expose 
internal representation by returning FileCleaningTracker.deleteFailures 
[org.apache.commons.io.FileCleaningTracker] At FileCleaningTracker.java:[line 
218] EI_EXPOSE_REP.</action>
       <!-- UPDATE -->
       <action dev="ggregory" type="update" due-to="Gary Gregory">Bump 
org.codehaus.mojo:exec-maven-plugin from 3.1.0 to 3.1.1 #512.</action>
       <action dev="ggregory" type="update" due-to="Gary Gregory">Bump 
commons-lang3 from 3.13.0 to 3.14.0.</action>      
diff --git a/src/main/java/org/apache/commons/io/FileCleaningTracker.java 
b/src/main/java/org/apache/commons/io/FileCleaningTracker.java
index 98c33b0d..cd0ca864 100644
--- a/src/main/java/org/apache/commons/io/FileCleaningTracker.java
+++ b/src/main/java/org/apache/commons/io/FileCleaningTracker.java
@@ -209,13 +209,13 @@ public class FileCleaningTracker {
     }
 
     /**
-     * Gets the file paths that failed to delete.
+     * Gets a copy of the file paths that failed to delete.
      *
-     * @return the file paths that failed to delete
+     * @return a copy of the file paths that failed to delete
      * @since 2.0
      */
     public List<String> getDeleteFailures() {
-        return deleteFailures;
+        return new ArrayList<>(deleteFailures);
     }
 
     /**

Reply via email to