Browse Source

Bz 22370: followsymlinks must default to true for consistency

master
Gintas Grigelionis 7 years ago
parent
commit
f71d39da3c
8 changed files with 29 additions and 24 deletions
  1. +5
    -0
      WHATSNEW
  2. +3
    -3
      manual/Types/selectors.html
  3. +5
    -5
      src/main/org/apache/tools/ant/types/selectors/OwnedBySelector.java
  4. +5
    -5
      src/main/org/apache/tools/ant/types/selectors/PosixGroupSelector.java
  5. +5
    -5
      src/main/org/apache/tools/ant/types/selectors/PosixPermissionsSelector.java
  6. +2
    -2
      src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java
  7. +2
    -2
      src/tests/junit/org/apache/tools/ant/types/selectors/PosixGroupSelectorTest.java
  8. +2
    -2
      src/tests/junit/org/apache/tools/ant/types/selectors/PosixPermissionsSelectorTest.java

+ 5
- 0
WHATSNEW View File

@@ -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
=====================================



+ 3
- 3
manual/Types/selectors.html View File

@@ -928,7 +928,7 @@
<tr>
<td>followsymlinks</td>
<td>Must the selector follow symbolic links?</td>
<td>No; defaults to <q>false</q> (was <q>true</q> before Ant 1.10.4)</td>
<td>No; defaults to <q>true</q></td>
</tr>
</table>

@@ -955,7 +955,7 @@
<tr>
<td>followsymlinks</td>
<td>Must the selector follow symbolic links?</td>
<td>No; defaults to <q>false</q></td>
<td>No; defaults to <q>true</q></td>
</tr>
</table>

@@ -982,7 +982,7 @@
<tr>
<td>followsymlinks</td>
<td>Must the selector follow symbolic links?</td>
<td>No; defaults to <q>false</q></td>
<td>No; defaults to <q>true</q></td>
</tr>
</table>



+ 5
- 5
src/main/org/apache/tools/ant/types/selectors/OwnedBySelector.java View File

@@ -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


+ 5
- 5
src/main/org/apache/tools/ant/types/selectors/PosixGroupSelector.java View File

@@ -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


+ 5
- 5
src/main/org/apache/tools/ant/types/selectors/PosixPermissionsSelector.java View File

@@ -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


+ 2
- 2
src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java View File

@@ -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()));
}
}

+ 2
- 2
src/tests/junit/org/apache/tools/ant/types/selectors/PosixGroupSelectorTest.java View File

@@ -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()));
}
}

+ 2
- 2
src/tests/junit/org/apache/tools/ant/types/selectors/PosixPermissionsSelectorTest.java View File

@@ -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()));
}
}



Loading…
Cancel
Save