diff --git a/WHATSNEW b/WHATSNEW index 63bb359c4..3bdab33d6 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -70,6 +70,11 @@ Other changes: can be used to specify the file's encoding. Bugzilla Report 62379 + * New file selectors, posixGroup and posixPermissions, are available. + The new selectors and related ownedBy selector have "followSymlinks" + attribute that defaults to "true" for consistency. + Bugzilla Report 22370 + Changes from Ant 1.10.2 TO Ant 1.10.3 ===================================== diff --git a/manual/Types/selectors.html b/manual/Types/selectors.html index e3d11b8ba..ef756a9a6 100644 --- a/manual/Types/selectors.html +++ b/manual/Types/selectors.html @@ -928,7 +928,7 @@ followsymlinks Must the selector follow symbolic links? - No; defaults to false (was true before Ant 1.10.4) + No; defaults to true @@ -955,7 +955,7 @@ followsymlinks Must the selector follow symbolic links? - No; defaults to false + No; defaults to true @@ -982,7 +982,7 @@ followsymlinks Must the selector follow symbolic links? - No; defaults to false + No; defaults to true diff --git a/src/main/org/apache/tools/ant/types/selectors/OwnedBySelector.java b/src/main/org/apache/tools/ant/types/selectors/OwnedBySelector.java index f9c593bdd..4399aa236 100644 --- a/src/main/org/apache/tools/ant/types/selectors/OwnedBySelector.java +++ b/src/main/org/apache/tools/ant/types/selectors/OwnedBySelector.java @@ -42,7 +42,7 @@ public class OwnedBySelector implements FileSelector { private String owner; - private boolean followSymlinks = false; + private boolean followSymlinks = true; /** * Sets the user name to look for. @@ -53,11 +53,11 @@ public class OwnedBySelector implements FileSelector { } /** - * Sets the "follow links" flag. - * @param followSymlinks the user name + * Sets the "follow symbolic links" option. + * @param followSymlinks whether or not symbolic links should be followed. */ - public void setFollowSymlinks(String followSymlinks) { - this.followSymlinks = PropertyHelper.toBoolean(followSymlinks); + public void setFollowSymlinks(boolean followSymlinks) { + this.followSymlinks = followSymlinks; } @Override diff --git a/src/main/org/apache/tools/ant/types/selectors/PosixGroupSelector.java b/src/main/org/apache/tools/ant/types/selectors/PosixGroupSelector.java index cdfc61287..900a327ce 100644 --- a/src/main/org/apache/tools/ant/types/selectors/PosixGroupSelector.java +++ b/src/main/org/apache/tools/ant/types/selectors/PosixGroupSelector.java @@ -42,7 +42,7 @@ public class PosixGroupSelector implements FileSelector { private String group; - private boolean followSymlinks = false; + private boolean followSymlinks = true; /** * Sets the group name to look for. @@ -53,11 +53,11 @@ public class PosixGroupSelector implements FileSelector { } /** - * Sets the "follow links" flag. - * @param followSymlinks the user name + * Sets the "follow symbolic links" option. + * @param followSymlinks whether or not symbolic links should be followed. */ - public void setFollowSymlinks(String followSymlinks) { - this.followSymlinks = PropertyHelper.toBoolean(followSymlinks); + public void setFollowSymlinks(boolean followSymlinks) { + this.followSymlinks = followSymlinks; } @Override diff --git a/src/main/org/apache/tools/ant/types/selectors/PosixPermissionsSelector.java b/src/main/org/apache/tools/ant/types/selectors/PosixPermissionsSelector.java index bc872ed5f..676646e86 100644 --- a/src/main/org/apache/tools/ant/types/selectors/PosixPermissionsSelector.java +++ b/src/main/org/apache/tools/ant/types/selectors/PosixPermissionsSelector.java @@ -41,7 +41,7 @@ public class PosixPermissionsSelector implements FileSelector { private String permissions; - private boolean followSymlinks = false; + private boolean followSymlinks = true; /** * Sets the permissions to look for. @@ -63,11 +63,11 @@ public class PosixPermissionsSelector implements FileSelector { } /** - * Sets the "follow links" flag. - * @param followSymlinks the user name + * Sets the "follow symbolic links" flag. + * @param followSymlinks whether or not symbolic links should be followed. */ - public void setFollowSymlinks(String followSymlinks) { - this.followSymlinks = PropertyHelper.toBoolean(followSymlinks); + public void setFollowSymlinks(boolean followSymlinks) { + this.followSymlinks = followSymlinks; } @Override diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java index 77b31ddfa..be0d71f6f 100644 --- a/src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java +++ b/src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java @@ -79,8 +79,8 @@ public class OwnedBySelectorTest { assertEquals(SELF, user.getName()); s.setOwner(SELF); - assertTrue(s.isSelected(null, null, symbolicLink.toFile())); - s.setFollowSymlinks("yes"); assertFalse(s.isSelected(null, null, symbolicLink.toFile())); + s.setFollowSymlinks(false); + assertTrue(s.isSelected(null, null, symbolicLink.toFile())); } } diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/PosixGroupSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/PosixGroupSelectorTest.java index f9a9d622c..fb5cce104 100644 --- a/src/tests/junit/org/apache/tools/ant/types/selectors/PosixGroupSelectorTest.java +++ b/src/tests/junit/org/apache/tools/ant/types/selectors/PosixGroupSelectorTest.java @@ -86,8 +86,8 @@ public class PosixGroupSelectorTest { targetGroup.getName()); s.setGroup(linkGroup.getName()); - assertTrue(s.isSelected(null, null, symbolicLink.toFile())); - s.setFollowSymlinks("yes"); assertFalse(s.isSelected(null, null, symbolicLink.toFile())); + s.setFollowSymlinks(false); + assertTrue(s.isSelected(null, null, symbolicLink.toFile())); } } diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/PosixPermissionsSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/PosixPermissionsSelectorTest.java index 9aff3b5e4..887c34db0 100644 --- a/src/tests/junit/org/apache/tools/ant/types/selectors/PosixPermissionsSelectorTest.java +++ b/src/tests/junit/org/apache/tools/ant/types/selectors/PosixPermissionsSelectorTest.java @@ -124,9 +124,9 @@ public class PosixPermissionsSelectorTest { Path symbolicLink = Files.createSymbolicLink(target.toPath(), TEST_FILE.toPath()); s.setPermissions(argument); - assertFalse(s.isSelected(null, null, symbolicLink.toFile())); - s.setFollowSymlinks("yes"); assertTrue(s.isSelected(null, null, symbolicLink.toFile())); + s.setFollowSymlinks(false); + assertFalse(s.isSelected(null, null, symbolicLink.toFile())); } }