Skip to content

Commit e539867

Browse files
committed
Fix SpotBugs errors
- [ERROR] Medium: org.apache.commons.io.file.AccumulatorPathVisitor.getDirList() may expose internal representation by returning AccumulatorPathVisitor.dirList [org.apache.commons.io.file.AccumulatorPathVisitor] At AccumulatorPathVisitor.java:[line 179] EI_EXPOSE_REP - [ERROR] Medium: org.apache.commons.io.file.AccumulatorPathVisitor.getFileList() may expose internal representation by returning AccumulatorPathVisitor.fileList [org.apache.commons.io.file.AccumulatorPathVisitor] At AccumulatorPathVisitor.java:[line 188] EI_EXPOSE_REP
1 parent 4a3e4f2 commit e539867

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/changes/changes.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ The <action> type attribute can be add,update,fix,remove.
6464
<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>
6565
<action dev="ggregory" type="fix" due-to="Gary Gregory">Fix SpotBugs error: org.apache.commons.io.IOExceptionList.getCauseList() may expose internal representation by returning IOExceptionList.causeList [org.apache.commons.io.IOExceptionList] At IOExceptionList.java:[line 118] EI_EXPOSE_REP.</action>
6666
<action dev="ggregory" type="fix" due-to="Gary Gregory">Fix SpotBugs error: org.apache.commons.io.IOExceptionList.getCauseList(Class) may expose internal representation by returning IOExceptionList.causeList [org.apache.commons.io.IOExceptionList] At IOExceptionList.java:[line 129] EI_EXPOSE_REP.</action>
67+
<action dev="ggregory" type="fix" due-to="Gary Gregory">Fix SpotBugs error: org.apache.commons.io.file.AccumulatorPathVisitor.getDirList() may expose internal representation by returning AccumulatorPathVisitor.dirList [org.apache.commons.io.file.AccumulatorPathVisitor] At AccumulatorPathVisitor.java:[line 179] EI_EXPOSE_REP.</action>
68+
<action dev="ggregory" type="fix" due-to="Gary Gregory">Fix SpotBugs error: org.apache.commons.io.file.AccumulatorPathVisitor.getFileList() may expose internal representation by returning AccumulatorPathVisitor.fileList [org.apache.commons.io.file.AccumulatorPathVisitor] At AccumulatorPathVisitor.java:[line 188] EI_EXPOSE_REP.</action>
6769
<!-- UPDATE -->
6870
<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>
6971
<action dev="ggregory" type="update" due-to="Gary Gregory">Bump commons-lang3 from 3.13.0 to 3.14.0.</action>

src/main/java/org/apache/commons/io/file/AccumulatorPathVisitor.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,21 +171,21 @@ public boolean equals(final Object obj) {
171171
}
172172

173173
/**
174-
* Gets the list of visited directories.
174+
* Gets a copy of the list of visited directories.
175175
*
176-
* @return the list of visited directories.
176+
* @return a copy of the list of visited directories.
177177
*/
178178
public List<Path> getDirList() {
179-
return dirList;
179+
return new ArrayList<>(dirList);
180180
}
181181

182182
/**
183-
* Gets the list of visited files.
183+
* Gets a copy of the list of visited files.
184184
*
185-
* @return the list of visited files.
185+
* @return a copy of the list of visited files.
186186
*/
187187
public List<Path> getFileList() {
188-
return fileList;
188+
return new ArrayList<>(fileList);
189189
}
190190

191191
@Override

0 commit comments

Comments
 (0)