Move test method as new PathUtils.getAclEntryList(Path).
MODIFY
src/changes/changes.xml
src/changes/changes.xml
@@ -86,6 +86,9 @@ The <action> type attribute can be add,update,fix,remove.
<action issue="IO-679" dev="ggregory" type="fix" due-to="proneel">
input.AbstractCharacterFilterReader passes count of chars read #132.
</action>
+ <action dev="ggregory" type="add" due-to="Gary Gregory">
+ Add PathUtils.getAclEntryList(Path).
+ </action>
<action dev="ggregory" type="fix" due-to="Gary Gregory">
Replace FindBugs with SpotBugs.
</action>

MODIFY
src/main/java/org/apache/commons/io/file/PathUtils.java
src/main/java/org/apache/commons/io/file/PathUtils.java
import java.nio.file.OpenOption;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.nio.file.attribute.AclEntry;
+import java.nio.file.attribute.AclFileAttributeView;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
@@ -479,6 +481,20 @@ public static boolean fileContentEquals(final Path path1, final Path path2, fina
}
}
+ /**
+ * Reads the access control list from a file attribute view.
+ *
+ * @param sourcePath the path to the file.
+ * @return a file attribute view of the specified type, or null ifthe attribute view type is not available.
+ * @throws IOException if an I/O error occurs.
+ * @since 2.8.0
+ */
+ public static List<AclEntry> getAclEntryList(final Path sourcePath) throws IOException {
+ final AclFileAttributeView fileAttributeView = Files.getFileAttributeView(sourcePath,
+ AclFileAttributeView.class);
+ return fileAttributeView == null ? null : fileAttributeView.getAcl();
+ }
+
/**
* Returns whether the given file or directory is empty.
*

MODIFY
src/test/java/org/apache/commons/io/FileUtilsCopyDirectoryToDirectoryTestCase.java
src/test/java/org/apache/commons/io/FileUtilsCopyDirectoryToDirectoryTestCase.java
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
-import java.nio.file.attribute.AclEntry;
-import java.nio.file.attribute.AclFileAttributeView;
-import java.util.List;
+import org.apache.commons.io.file.PathUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
@@ -58,7 +56,7 @@ private static void assertExceptionTypeAndMessage(final File srcDir, final File
public File temporaryFolder;
private void assertAcl(final Path sourcePath, final Path destPath) throws IOException {
- assertEquals(getAclEntryList(sourcePath), getAclEntryList(destPath));
+ assertEquals(PathUtils.getAclEntryList(sourcePath), PathUtils.getAclEntryList(destPath));
}
@Test
@@ -116,17 +114,4 @@ public void copyFileAndCheckAcl() throws IOException {
StandardCopyOption.COPY_ATTRIBUTES);
assertAcl(sourcePath, destPath);
}
-
- /**
- * Gets a a file attribute view.
- *
- * @param sourcePath the path to the file.
- * @return a file attribute view of the specified type, or null ifthe attribute view type is not available.
- * @throws IOException if an I/O error occurs.
- */
- private List<AclEntry> getAclEntryList(final Path sourcePath) throws IOException {
- final AclFileAttributeView fileAttributeView = Files.getFileAttributeView(sourcePath,
- AclFileAttributeView.class);
- return fileAttributeView == null ? null : fileAttributeView.getAcl();
- }
}

Move test method as new PathUtils.getAclEntryList(Path).