diff options
author | Stefan Bodewig <bodewig@apache.org> | 2021-09-26 10:58:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-26 10:58:54 +0200 |
commit | 48c6dc53f636c706fc3196f4de4d52c559b63603 (patch) | |
tree | 9f96f0e2909d9221fa4d3bb442c44c813b85a1b5 /src/main/org/apache/tools/ant/taskdefs | |
parent | 87ac5d5ddbf6617745d43467338233a0e384b061 (diff) | |
parent | 0ad2609358b127bbeba03c4d8c0e89ad3443dda8 (diff) | |
download | ant-48c6dc53f636c706fc3196f4de4d52c559b63603.tar.gz |
Merge pull request #155 from arturobernalg/feature/redundant_if
Simplify single assignment and avoid redundant if conditions.
Diffstat (limited to 'src/main/org/apache/tools/ant/taskdefs')
-rw-r--r-- | src/main/org/apache/tools/ant/taskdefs/Tar.java | 5 | ||||
-rw-r--r-- | src/main/org/apache/tools/ant/taskdefs/XmlProperty.java | 7 |
2 files changed, 3 insertions, 9 deletions
diff --git a/src/main/org/apache/tools/ant/taskdefs/Tar.java b/src/main/org/apache/tools/ant/taskdefs/Tar.java index 3fb9da510..b5a254fbf 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Tar.java +++ b/src/main/org/apache/tools/ant/taskdefs/Tar.java @@ -638,10 +638,7 @@ public class Tar extends MatchingTask { * @since Ant 1.7 */ 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) { if (tarFile.equals(new File(basedir, file))) { diff --git a/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java b/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java index 4a86ca0b9..4e07c3a97 100644 --- a/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java +++ b/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java @@ -404,17 +404,14 @@ public class XmlProperty extends Task { } String nodeText = null; boolean emptyNode = false; - boolean semanticEmptyOverride = false; - if (node.getNodeType() == Node.ELEMENT_NODE + boolean semanticEmptyOverride = node.getNodeType() == Node.ELEMENT_NODE && semanticAttributes && node.hasAttributes() && (node.getAttributes().getNamedItem(VALUE) != null || node.getAttributes().getNamedItem(LOCATION) != null || node.getAttributes().getNamedItem(REF_ID) != null || node.getAttributes().getNamedItem(PATH) != null || node.getAttributes() - .getNamedItem(PATHID) != null)) { - semanticEmptyOverride = true; - } + .getNamedItem(PATHID) != null); if (node.getNodeType() == Node.TEXT_NODE) { // For the text node, add a property. nodeText = getAttributeValue(node); |