Browse Source

Merge pull request #155 from arturobernalg/feature/redundant_if

Simplify single assignment and avoid redundant if  conditions.
master
Stefan Bodewig GitHub 3 years ago
parent
commit
48c6dc53f6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 13 deletions
  1. +1
    -4
      src/main/org/apache/tools/ant/taskdefs/Tar.java
  2. +2
    -5
      src/main/org/apache/tools/ant/taskdefs/XmlProperty.java
  3. +1
    -4
      src/main/org/apache/tools/ant/types/Permissions.java

+ 1
- 4
src/main/org/apache/tools/ant/taskdefs/Tar.java View File

@@ -638,10 +638,7 @@ public class Tar extends MatchingTask {
* @since Ant 1.7 * @since Ant 1.7
*/ */
protected boolean check(final File basedir, final String[] files) { protected boolean check(final File basedir, final String[] files) {
boolean upToDate = true;
if (!archiveIsUpToDate(files, basedir)) {
upToDate = false;
}
boolean upToDate = archiveIsUpToDate(files, basedir);


for (String file : files) { for (String file : files) {
if (tarFile.equals(new File(basedir, file))) { if (tarFile.equals(new File(basedir, file))) {


+ 2
- 5
src/main/org/apache/tools/ant/taskdefs/XmlProperty.java View File

@@ -404,17 +404,14 @@ public class XmlProperty extends Task {
} }
String nodeText = null; String nodeText = null;
boolean emptyNode = false; boolean emptyNode = false;
boolean semanticEmptyOverride = false;
if (node.getNodeType() == Node.ELEMENT_NODE
boolean semanticEmptyOverride = node.getNodeType() == Node.ELEMENT_NODE
&& semanticAttributes && semanticAttributes
&& node.hasAttributes() && node.hasAttributes()
&& (node.getAttributes().getNamedItem(VALUE) != null && (node.getAttributes().getNamedItem(VALUE) != null
|| node.getAttributes().getNamedItem(LOCATION) != null || node.getAttributes().getNamedItem(LOCATION) != null
|| node.getAttributes().getNamedItem(REF_ID) != null || node.getAttributes().getNamedItem(REF_ID) != null
|| node.getAttributes().getNamedItem(PATH) != null || node.getAttributes() || node.getAttributes().getNamedItem(PATH) != null || node.getAttributes()
.getNamedItem(PATHID) != null)) {
semanticEmptyOverride = true;
}
.getNamedItem(PATHID) != null);
if (node.getNodeType() == Node.TEXT_NODE) { if (node.getNodeType() == Node.TEXT_NODE) {
// For the text node, add a property. // For the text node, add a property.
nodeText = getAttributeValue(node); nodeText = getAttributeValue(node);


+ 1
- 4
src/main/org/apache/tools/ant/types/Permissions.java View File

@@ -207,10 +207,7 @@ public class Permissions {
public void checkPermission(final java.security.Permission perm) { public void checkPermission(final java.security.Permission perm) {
if (active) { if (active) {
if (delegateToOldSM && !perm.getName().equals("exitVM")) { if (delegateToOldSM && !perm.getName().equals("exitVM")) {
boolean permOK = false;
if (granted.implies(perm)) {
permOK = true;
}
boolean permOK = granted.implies(perm);
checkRevoked(perm); checkRevoked(perm);
/* /*
if the permission was not explicitly granted or revoked if the permission was not explicitly granted or revoked


Loading…
Cancel
Save