You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by gi...@apache.org on 2018/11/04 11:56:44 UTC

ant git commit: SonarQube: nested if’s is a major code smell

Repository: ant
Updated Branches:
  refs/heads/master e8762432b -> 2b699eb69


SonarQube: nested if’s is a major code smell

Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/2b699eb6
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/2b699eb6
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/2b699eb6

Branch: refs/heads/master
Commit: 2b699eb695dd42f5343f8f007a87b01e499b146b
Parents: e876243
Author: Gintas Grigelionis <gi...@apache.org>
Authored: Sun Nov 4 12:56:27 2018 +0100
Committer: Gintas Grigelionis <gi...@apache.org>
Committed: Sun Nov 4 12:56:27 2018 +0100

----------------------------------------------------------------------
 .../apache/tools/ant/IntrospectionHelper.java   | 11 ++--
 src/main/org/apache/tools/ant/Main.java         | 18 ++----
 .../org/apache/tools/ant/PropertyHelper.java    | 50 ++++++---------
 .../apache/tools/ant/RuntimeConfigurable.java   |  8 +--
 .../org/apache/tools/ant/UnknownElement.java    | 17 ++---
 .../apache/tools/ant/filters/ConcatFilter.java  | 18 +++---
 .../apache/tools/ant/filters/HeadFilter.java    | 14 ++---
 .../tools/ant/filters/StripJavaComments.java    | 36 +++++------
 .../apache/tools/ant/filters/TabsToSpaces.java  |  8 +--
 .../apache/tools/ant/helper/ProjectHelper2.java | 29 ++++-----
 .../apache/tools/ant/taskdefs/Available.java    | 29 +++------
 .../apache/tools/ant/taskdefs/ExecuteOn.java    | 11 ++--
 .../org/apache/tools/ant/taskdefs/Jikes.java    |  6 +-
 .../org/apache/tools/ant/taskdefs/SQLExec.java  |  9 +--
 src/main/org/apache/tools/ant/taskdefs/Zip.java |  6 +-
 .../tools/ant/taskdefs/email/EmailAddress.java  | 11 ++--
 .../ant/taskdefs/optional/depend/Depend.java    | 27 +++-----
 .../optional/ejb/DescriptorHandler.java         | 14 ++---
 .../optional/ejb/JonasDeploymentTool.java       | 36 +++++------
 .../taskdefs/optional/extension/Extension.java  | 66 +++++++-------------
 .../ant/taskdefs/optional/junit/JUnitTask.java  | 65 +++++++++----------
 .../tools/ant/taskdefs/optional/net/FTP.java    | 27 ++++----
 .../optional/net/FTPTaskMirrorImpl.java         | 33 +++++-----
 .../optional/ssh/ScpFromMessageBySftp.java      | 12 ++--
 .../tools/ant/types/resources/URLResource.java  | 20 +++---
 .../tools/ant/util/GlobPatternMapper.java       |  6 +-
 .../ant/util/LayoutPreservingProperties.java    |  8 +--
 .../tools/ant/util/RegexpPatternMapper.java     |  9 +--
 src/main/org/apache/tools/tar/TarBuffer.java    | 11 ++--
 29 files changed, 254 insertions(+), 361 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/IntrospectionHelper.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/IntrospectionHelper.java b/src/main/org/apache/tools/ant/IntrospectionHelper.java
index 15307c8..4f1defe 100644
--- a/src/main/org/apache/tools/ant/IntrospectionHelper.java
+++ b/src/main/org/apache/tools/ant/IntrospectionHelper.java
@@ -218,11 +218,12 @@ public final class IntrospectionHelper {
                         */
                         continue;
                     }
-                    if (File.class.equals(args[0])) {
-                        // Ant Resources/FileProviders override java.io.File
-                        if (Resource.class.equals(as.type) || FileProvider.class.equals(as.type)) {
-                            continue;
-                        }
+                    if (File.class.equals(args[0])
+                            && (Resource.class.equals(as.type) || FileProvider.class.equals(as.type))) {
+                        /*
+                            Ant Resources/FileProviders override java.io.File
+                         */
+                        continue;
                     }
                     /*
                         In cases other than those just explicitly covered,

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/Main.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/Main.java b/src/main/org/apache/tools/ant/Main.java
index 5dd4f68..bc51b6c 100644
--- a/src/main/org/apache/tools/ant/Main.java
+++ b/src/main/org/apache/tools/ant/Main.java
@@ -737,10 +737,8 @@ public class Main implements AntMain {
 
         for (final ArgumentProcessor processor : processorRegistry.getProcessors()) {
             final List<String> extraArgs = extraArguments.get(processor.getClass());
-            if (extraArgs != null) {
-                if (processor.handleArg(extraArgs)) {
-                    return;
-                }
+            if (extraArgs != null && processor.handleArg(extraArgs)) {
+                return;
             }
         }
 
@@ -810,10 +808,8 @@ public class Main implements AntMain {
 
                 for (final ArgumentProcessor processor : processorRegistry.getProcessors()) {
                     final List<String> extraArgs = extraArguments.get(processor.getClass());
-                    if (extraArgs != null) {
-                        if (processor.handleArg(project, extraArgs)) {
-                            return;
-                        }
+                    if (extraArgs != null && processor.handleArg(project, extraArgs)) {
+                        return;
                     }
                 }
 
@@ -825,10 +821,8 @@ public class Main implements AntMain {
                 }
 
                 // make sure that we have a target to execute
-                if (targets.isEmpty()) {
-                    if (project.getDefaultTarget() != null) {
-                        targets.addElement(project.getDefaultTarget());
-                    }
+                if (targets.isEmpty() && project.getDefaultTarget() != null) {
+                    targets.addElement(project.getDefaultTarget());
                 }
 
                 project.executeTargets(targets);

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/PropertyHelper.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/PropertyHelper.java b/src/main/org/apache/tools/ant/PropertyHelper.java
index fdd4376..84e8bb2 100644
--- a/src/main/org/apache/tools/ant/PropertyHelper.java
+++ b/src/main/org/apache/tools/ant/PropertyHelper.java
@@ -144,8 +144,7 @@ public class PropertyHelper implements GetProperty {
          * @param propertyHelper the invoking PropertyHelper.
          * @return true if this entity 'owns' the property.
          */
-        boolean setNew(
-            String property, Object value, PropertyHelper propertyHelper);
+        boolean setNew(String property, Object value, PropertyHelper propertyHelper);
 
         /**
          * Set a property.
@@ -157,8 +156,7 @@ public class PropertyHelper implements GetProperty {
          * @param propertyHelper the invoking PropertyHelper.
          * @return true if this entity 'owns' the property.
          */
-        boolean set(
-            String property, Object value, PropertyHelper propertyHelper);
+        boolean set(String property, Object value, PropertyHelper propertyHelper);
     }
 
     //TODO PropertyEnumerator Delegate type, would improve PropertySet
@@ -173,6 +171,7 @@ public class PropertyHelper implements GetProperty {
         private final String PREFIX = "toString:";
         private final int PREFIX_LEN = PREFIX.length();
 
+        @Override
         public Object evaluate(String property, PropertyHelper propertyHelper) {
             Object o = null;
             if (property.startsWith(PREFIX) && propertyHelper.getProject() != null) {
@@ -182,18 +181,15 @@ public class PropertyHelper implements GetProperty {
         }
     };
 
-    private static final PropertyExpander DEFAULT_EXPANDER =
-        (s, pos, notUsed) -> {
+    private static final PropertyExpander DEFAULT_EXPANDER = (s, pos, notUsed) -> {
             int index = pos.getIndex();
             //directly check near, triggering characters:
-            if (s.length() - index >= 3 && '$' == s.charAt(index)
-                && '{' == s.charAt(index + 1)) {
+            if (s.length() - index >= 3 && '$' == s.charAt(index) && '{' == s.charAt(index + 1)) {
                 int start = index + 2;
                 //defer to String.indexOf() for protracted check:
                 int end = s.indexOf('}', start);
                 if (end < 0) {
-                    throw new BuildException(
-                        "Syntax error in property: " + s.substring(index));
+                    throw new BuildException("Syntax error in property: " + s.substring(index));
                 }
                 pos.setIndex(end + 1);
                 return start == end ? "" : s.substring(start, end);
@@ -202,19 +198,16 @@ public class PropertyHelper implements GetProperty {
         };
 
     /** dummy */
-    private static final PropertyExpander SKIP_DOUBLE_DOLLAR =
-        (s, pos, notUsed) -> {
+    private static final PropertyExpander SKIP_DOUBLE_DOLLAR = (s, pos, notUsed) -> {
             int index = pos.getIndex();
-            if (s.length() - index >= 2) {
-                /* check for $$; if found, advance by one--
-                 * this expander is at the bottom of the stack
-                 * and will thus be the last consulted,
-                 * so the next thing that ParseProperties will do
-                 * is advance the parse position beyond the second $
-                 */
-                if ('$' == s.charAt(index) && '$' == s.charAt(++index)) {
-                    pos.setIndex(index);
-                }
+            /* check for $$; if found, advance by one--
+             * this expander is at the bottom of the stack
+             * and will thus be the last consulted,
+             * so the next thing that ParseProperties will do
+             * is advance the parse position beyond the second $
+             */
+            if (s.length() - index >= 2 && '$' == s.charAt(index) && '$' == s.charAt(++index)) {
+                pos.setIndex(index);
             }
             return null;
         };
@@ -226,6 +219,7 @@ public class PropertyHelper implements GetProperty {
         private final String PREFIX = "ant.refid:";
         private final int PREFIX_LEN = PREFIX.length();
 
+        @Override
         public Object evaluate(String prop, PropertyHelper helper) {
             return prop.startsWith(PREFIX) && helper.getProject() != null
                 ? helper.getProject().getReference(prop.substring(PREFIX_LEN))
@@ -279,8 +273,7 @@ public class PropertyHelper implements GetProperty {
      * @since Ant 1.8.0
      */
     public static Object getProperty(Project project, String name) {
-        return PropertyHelper.getPropertyHelper(project)
-            .getProperty(name);
+        return PropertyHelper.getPropertyHelper(project).getProperty(name);
     }
 
     /**
@@ -292,8 +285,7 @@ public class PropertyHelper implements GetProperty {
      * @since Ant 1.8.0
      */
     public static void setProperty(Project project, String name, Object value) {
-        PropertyHelper.getPropertyHelper(project)
-            .setProperty(name, value, true);
+        PropertyHelper.getPropertyHelper(project).setProperty(name, value, true);
     }
 
     /**
@@ -304,10 +296,8 @@ public class PropertyHelper implements GetProperty {
      * @param value the value to use.
      * @since Ant 1.8.0
      */
-    public static void setNewProperty(
-        Project project, String name, Object value) {
-        PropertyHelper.getPropertyHelper(project)
-            .setNewProperty(name, value);
+    public static void setNewProperty(Project project, String name, Object value) {
+        PropertyHelper.getPropertyHelper(project).setNewProperty(name, value);
     }
 
     //override facility for subclasses to put custom hashtables in

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/RuntimeConfigurable.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/RuntimeConfigurable.java b/src/main/org/apache/tools/ant/RuntimeConfigurable.java
index 90c34a2..e7b187b 100644
--- a/src/main/org/apache/tools/ant/RuntimeConfigurable.java
+++ b/src/main/org/apache/tools/ant/RuntimeConfigurable.java
@@ -596,11 +596,9 @@ public class RuntimeConfigurable implements Serializable {
         }
 
         // Text
-        if (r.characters != null) {
-            if (characters == null
-                || characters.toString().trim().isEmpty()) {
-                characters = new StringBuffer(r.characters.toString());
-            }
+        if (r.characters != null
+                && (characters == null || characters.toString().trim().isEmpty())) {
+            characters = new StringBuffer(r.characters.toString());
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/UnknownElement.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/UnknownElement.java b/src/main/org/apache/tools/ant/UnknownElement.java
index 4d1cc31..fff6ff4 100644
--- a/src/main/org/apache/tools/ant/UnknownElement.java
+++ b/src/main/org/apache/tools/ant/UnknownElement.java
@@ -346,19 +346,14 @@ public class UnknownElement extends Task {
                 RuntimeConfigurable childWrapper = parentWrapper.getChild(i);
                 UnknownElement child = it.next();
                 try {
-                    if (!childWrapper.isEnabled(child)) {
-                        if (ih.supportsNestedElement(
-                                parentUri, ProjectHelper.genComponentName(
-                                    child.getNamespace(), child.getTag()))) {
-                            continue;
-                        }
-                        // fall tru and fail in handlechild (unsupported element)
+                    // fall tru and fail in handlechild (unsupported element)
+                    if (!childWrapper.isEnabled(child) && ih.supportsNestedElement(parentUri,
+                            ProjectHelper.genComponentName(child.getNamespace(), child.getTag()))) {
+                        continue;
                     }
-                    if (!handleChild(
-                            parentUri, ih, parent, child, childWrapper)) {
+                    if (!handleChild(parentUri, ih, parent, child, childWrapper)) {
                         if (!(parent instanceof TaskContainer)) {
-                            ih.throwNotSupported(getProject(), parent,
-                                                 child.getTag());
+                            ih.throwNotSupported(getProject(), parent, child.getTag());
                         } else {
                             // a task container - anything could happen - just add the
                             // child to the container

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/filters/ConcatFilter.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/filters/ConcatFilter.java b/src/main/org/apache/tools/ant/filters/ConcatFilter.java
index 72b68f8..76232e4 100644
--- a/src/main/org/apache/tools/ant/filters/ConcatFilter.java
+++ b/src/main/org/apache/tools/ant/filters/ConcatFilter.java
@@ -113,16 +113,14 @@ public final class ConcatFilter extends BaseParamFilterReader
         if (ch == -1) {
             ch = super.read();
         }
-        if (ch == -1) {
-            // don't call super.close() because that reader is used
-            // on other places ...
-            if (appendReader != null) {
-                ch = appendReader.read();
-                if (ch == -1) {
-                    // I am the only one so I have to close the reader
-                    appendReader.close();
-                    appendReader = null;
-                }
+        // don't call super.close() because that reader is used
+        // on other places ...
+        if (ch == -1 && appendReader != null) {
+            ch = appendReader.read();
+            if (ch == -1) {
+                // I am the only one so I have to close the reader
+                appendReader.close();
+                appendReader = null;
             }
         }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/filters/HeadFilter.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/filters/HeadFilter.java b/src/main/org/apache/tools/ant/filters/HeadFilter.java
index 3ac59b7..931e7a4 100644
--- a/src/main/org/apache/tools/ant/filters/HeadFilter.java
+++ b/src/main/org/apache/tools/ant/filters/HeadFilter.java
@@ -203,17 +203,13 @@ public final class HeadFilter extends BaseParamFilterReader
      */
     private String headFilter(String line) {
         linesRead++;
-        if (skip > 0) {
-            if ((linesRead - 1) < skip) {
-                return null;
-            }
+        if (skip > 0 && (linesRead - 1) < skip) {
+            return null;
         }
 
-        if (lines > 0) {
-            if (linesRead > (lines + skip)) {
-                eof = true;
-                return null;
-            }
+        if (lines > 0 && linesRead > (lines + skip)) {
+            eof = true;
+            return null;
         }
         return line;
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/filters/StripJavaComments.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/filters/StripJavaComments.java b/src/main/org/apache/tools/ant/filters/StripJavaComments.java
index 488873e..fa5f34a 100644
--- a/src/main/org/apache/tools/ant/filters/StripJavaComments.java
+++ b/src/main/org/apache/tools/ant/filters/StripJavaComments.java
@@ -93,32 +93,30 @@ public final class StripJavaComments
                 quoted = !quoted;
             } else {
                 quoted = false;
-                if (!inString) {
+                if (!inString && ch == '/') {
+                    ch = in.read();
                     if (ch == '/') {
-                        ch = in.read();
-                        if (ch == '/') {
-                            while (ch != '\n' && ch != -1 && ch != '\r') {
-                                ch = in.read();
-                            }
-                        } else if (ch == '*') {
-                            while (ch != -1) {
+                        while (ch != '\n' && ch != -1 && ch != '\r') {
+                            ch = in.read();
+                        }
+                    } else if (ch == '*') {
+                        while (ch != -1) {
+                            ch = in.read();
+                            if (ch == '*') {
                                 ch = in.read();
-                                if (ch == '*') {
+                                while (ch == '*') {
                                     ch = in.read();
-                                    while (ch == '*') {
-                                        ch = in.read();
-                                    }
+                                }
 
-                                    if (ch == '/') {
-                                        ch = read();
-                                        break;
-                                    }
+                                if (ch == '/') {
+                                    ch = read();
+                                    break;
                                 }
                             }
-                        } else {
-                            readAheadCh = ch;
-                            ch = '/';
                         }
+                    } else {
+                        readAheadCh = ch;
+                        ch = '/';
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/filters/TabsToSpaces.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/filters/TabsToSpaces.java b/src/main/org/apache/tools/ant/filters/TabsToSpaces.java
index 15c7c50..15ab656 100644
--- a/src/main/org/apache/tools/ant/filters/TabsToSpaces.java
+++ b/src/main/org/apache/tools/ant/filters/TabsToSpaces.java
@@ -143,11 +143,9 @@ public final class TabsToSpaces
         Parameter[] params = getParameters();
         if (params != null) {
             for (Parameter param : params) {
-                if (param != null) {
-                    if (TAB_LENGTH_KEY.equals(param.getName())) {
-                        tabLength = Integer.parseInt(param.getValue());
-                        break;
-                    }
+                if (param != null && TAB_LENGTH_KEY.equals(param.getName())) {
+                    tabLength = Integer.parseInt(param.getValue());
+                    break;
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/helper/ProjectHelper2.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/helper/ProjectHelper2.java b/src/main/org/apache/tools/ant/helper/ProjectHelper2.java
index 42f2b36..b53fa9b 100644
--- a/src/main/org/apache/tools/ant/helper/ProjectHelper2.java
+++ b/src/main/org/apache/tools/ant/helper/ProjectHelper2.java
@@ -728,10 +728,8 @@ public class ProjectHelper2 extends ProjectHelper {
                 String value = attrs.getValue(i);
                 switch (attrs.getLocalName(i)) {
                     case "default":
-                        if (value != null && !value.isEmpty()) {
-                            if (!context.isIgnoringProjectTag()) {
-                                project.setDefault(value);
-                            }
+                        if (value != null && !value.isEmpty() && !context.isIgnoringProjectTag()) {
+                            project.setDefault(value);
                         }
                         break;
                     case "name":
@@ -741,22 +739,21 @@ public class ProjectHelper2 extends ProjectHelper {
                             if (!context.isIgnoringProjectTag()) {
                                 project.setName(value);
                                 project.addReference(value, project);
-                            } else if (isInIncludeMode()) {
-                                if (!value.isEmpty() && getCurrentTargetPrefix() != null
-                                        && getCurrentTargetPrefix().endsWith(ProjectHelper.USE_PROJECT_NAME_AS_TARGET_PREFIX)) {
-                                    String newTargetPrefix = getCurrentTargetPrefix().replace(ProjectHelper.USE_PROJECT_NAME_AS_TARGET_PREFIX, value);
-                                    // help nested include tasks
-                                    setCurrentTargetPrefix(newTargetPrefix);
-                                }
+                            } else if (isInIncludeMode() && !value.isEmpty()
+                                    && getCurrentTargetPrefix() != null
+                                    && getCurrentTargetPrefix().endsWith(
+                                            ProjectHelper.USE_PROJECT_NAME_AS_TARGET_PREFIX)) {
+                                String newTargetPrefix = getCurrentTargetPrefix().replace(
+                                        ProjectHelper.USE_PROJECT_NAME_AS_TARGET_PREFIX, value);
+                                // help nested include tasks
+                                setCurrentTargetPrefix(newTargetPrefix);
                             }
                         }
                         break;
                     case "id":
-                        if (value != null) {
-                            // What's the difference between id and name ?
-                            if (!context.isIgnoringProjectTag()) {
-                                project.addReference(value, project);
-                            }
+                        // What's the difference between id and name ?
+                        if (value != null && !context.isIgnoringProjectTag()) {
+                            project.addReference(value, project);
                         }
                         break;
                     case "basedir":

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/taskdefs/Available.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Available.java b/src/main/org/apache/tools/ant/taskdefs/Available.java
index 1a4f2b5..83100d3 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Available.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Available.java
@@ -266,12 +266,10 @@ public class Available extends Task implements Condition {
                     "At least one of (classname|file|resource) is required",
                     getLocation());
             }
-            if (type != null) {
-                if (file == null) {
-                    throw new BuildException(
+            if (type != null && file == null) {
+                throw new BuildException(
                         "The type attribute is only valid when specifying the file attribute.",
                         getLocation());
-                }
             }
             if (classpath != null) {
                 classpath.setProject(getProject());
@@ -342,19 +340,16 @@ public class Available extends Task implements Condition {
             // **   full-pathname specified == path in list
             // **   simple name specified   == path in list
             if (path.exists()
-                && (filename.equals(p)
-                    || filename.equals(path.getName()))) {
+                && (filename.equals(p) || filename.equals(path.getName()))) {
                 if (type == null) {
                     log("Found: " + path, Project.MSG_VERBOSE);
                     return true;
                 }
-                if (type.isDir()
-                           && path.isDirectory()) {
+                if (type.isDir() && path.isDirectory()) {
                     log("Found directory: " + path, Project.MSG_VERBOSE);
                     return true;
                 }
-                if (type.isFile()
-                           && path.isFile()) {
+                if (type.isFile() && path.isFile()) {
                     log("Found file: " + path, Project.MSG_VERBOSE);
                     return true;
                 }
@@ -363,8 +358,7 @@ public class Available extends Task implements Condition {
             }
             File parent = path.getParentFile();
             // **   full-pathname specified == parent dir of path in list
-            if (parent != null && parent.exists()
-                && filename.equals(parent.getAbsolutePath())) {
+            if (parent != null && parent.exists() && filename.equals(parent.getAbsolutePath())) {
                 if (type == null) {
                     log("Found: " + parent, Project.MSG_VERBOSE);
                     return true;
@@ -377,17 +371,14 @@ public class Available extends Task implements Condition {
                 return false;
             }
             // **   simple name specified   == path in list + name
-            if (path.exists() && path.isDirectory()) {
-                if (checkFile(new File(path, filename),
-                              filename + " in " + path)) {
-                    return true;
-                }
+            if (path.exists() && path.isDirectory()
+                    && checkFile(new File(path, filename), filename + " in " + path)) {
+                return true;
             }
 
             // **   simple name specified   == parent dir + name
             while (searchParents && parent != null && parent.exists()) {
-                if (checkFile(new File(parent, filename),
-                              filename + " in " + parent)) {
+                if (checkFile(new File(parent, filename), filename + " in " + parent)) {
                     return true;
                 }
                 parent = parent.getParentFile();

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
index 8994978..8d80132 100644
--- a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
+++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
@@ -361,13 +361,12 @@ public class ExecuteOn extends ExecTask {
             Vector<File> baseDirs = new Vector<>();
             for (AbstractFileSet fs : filesets) {
                 String currentType = type;
-                if (fs instanceof DirSet) {
-                    if (!FileDirBoth.DIR.equals(type)) {
-                        log("Found a nested dirset but type is " + type + ". "
-                            + "Temporarily switching to type=\"dir\" on the assumption that you really did mean <dirset> not <fileset>.",
+                if (fs instanceof DirSet && !FileDirBoth.DIR.equals(type)) {
+                    log("Found a nested dirset but type is " + type + ". "
+                                    + "Temporarily switching to type=\"dir\" on the assumption"
+                                    + " that you really did mean <dirset> not <fileset>.",
                             Project.MSG_DEBUG);
-                        currentType = FileDirBoth.DIR;
-                    }
+                    currentType = FileDirBoth.DIR;
                 }
                 File base = fs.getDir(getProject());
 

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/taskdefs/Jikes.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Jikes.java b/src/main/org/apache/tools/ant/taskdefs/Jikes.java
index 3896001..4e299e2 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Jikes.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Jikes.java
@@ -123,10 +123,8 @@ public class Jikes {
                 throw new BuildException("Error running Jikes compiler", e);
             }
         } finally {
-            if (tmpFile != null) {
-                if (!tmpFile.delete()) {
-                    tmpFile.deleteOnExit();
-                }
+            if (tmpFile != null && !tmpFile.delete()) {
+                tmpFile.deleteOnExit();
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
index 73deb8a..15f6552 100644
--- a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
+++ b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
@@ -619,17 +619,14 @@ public class SQLExec extends JDBCTask {
         sqlCommand = sqlCommand.trim();
 
         try {
-            if (srcFile == null && sqlCommand.isEmpty() && resources == null) {
-                if (transactions.isEmpty()) {
-                    throw new BuildException(
+            if (srcFile == null && sqlCommand.isEmpty() && resources == null && transactions.isEmpty()) {
+                throw new BuildException(
                         "Source file or resource collection, transactions or sql statement must be set!",
                         getLocation());
-                }
             }
 
             if (srcFile != null && !srcFile.isFile()) {
-                throw new BuildException("Source file " + srcFile
-                        + " is not a file!", getLocation());
+                throw new BuildException("Source file " + srcFile + " is not a file!", getLocation());
             }
 
             if (resources != null) {

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/taskdefs/Zip.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Zip.java b/src/main/org/apache/tools/ant/taskdefs/Zip.java
index 65bfdec..696b5d6 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Zip.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Zip.java
@@ -761,11 +761,9 @@ public class Zip extends MatchingTask {
 
                 // If we've been successful on an update, delete the
                 // temporary file
-                if (doUpdate) {
-                    if (!renamedFile.delete()) {
-                        log("Warning: unable to delete temporary file "
+                if (doUpdate && !renamedFile.delete()) {
+                    log("Warning: unable to delete temporary file "
                             + renamedFile.getName(), Project.MSG_WARN);
-                    }
                 }
                 success = true;
             } finally {

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/taskdefs/email/EmailAddress.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/email/EmailAddress.java b/src/main/org/apache/tools/ant/taskdefs/email/EmailAddress.java
index f8e2133..eb317f8 100644
--- a/src/main/org/apache/tools/ant/taskdefs/email/EmailAddress.java
+++ b/src/main/org/apache/tools/ant/taskdefs/email/EmailAddress.java
@@ -51,12 +51,11 @@ public class EmailAddress {
         int len = email.length();
 
         // shortcut for "<address>"
-        if (len > minLen) {
-            if ((email.charAt(0) == '<' || email.charAt(1) == '<')
-            && (email.charAt(len - 1) == '>' || email.charAt(len - 2) == '>')) {
-                this.address = trim(email, true);
-                return;
-            }
+        if (len > minLen
+                && (email.charAt(0) == '<' || email.charAt(1) == '<')
+                && (email.charAt(len - 1) == '>' || email.charAt(len - 2) == '>')) {
+            this.address = trim(email, true);
+            return;
         }
 
         int paramDepth = 0;

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java b/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java
index 8b80cb8..4f2cf13 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java
@@ -305,15 +305,12 @@ public class Depend extends MatchingTask {
 
             List<String> dependencyList = null;
 
-            if (cache != null) {
-                // try to read the dependency info from the map if it is
-                // not out of date
-                if (cacheFileExists
+            // try to read the dependency info from the map if it is not out of date
+            if (cache != null && cacheFileExists
                     && cacheLastModified > info.absoluteFile.lastModified()) {
-                    // depFile exists and is newer than the class file
-                    // need to get dependency list from the map.
-                    dependencyList = dependencyMap.get(info.className);
-                }
+                // depFile exists and is newer than the class file
+                // need to get dependency list from the map.
+                dependencyList = dependencyMap.get(info.className);
             }
 
             if (dependencyList == null) {
@@ -512,20 +509,16 @@ public class Depend extends MatchingTask {
      * @param affectedClass the name of the affected .class file
      * @param className the file that is triggering the out of dateness
      */
-    private void warnOutOfDateButNotDeleted(
-                                            ClassFileInfo affectedClassInfo, String affectedClass,
+    private void warnOutOfDateButNotDeleted(ClassFileInfo affectedClassInfo, String affectedClass,
                                             String className) {
         if (affectedClassInfo.isUserWarned) {
             return;
         }
         int level = Project.MSG_WARN;
-        if (!warnOnRmiStubs) {
-            //downgrade warnings on RMI stublike classes, as they are generated
-            //by rmic, so there is no need to tell the user that their source is
-            //missing.
-            if (isRmiStub(affectedClass, className)) {
-                level = Project.MSG_VERBOSE;
-            }
+        // downgrade warnings on RMI stublike classes, as they are generated by rmic,
+        // so there is no need to tell the user that their source is missing.
+        if (!warnOnRmiStubs && isRmiStub(affectedClass, className)) {
+            level = Project.MSG_VERBOSE;
         }
         log("The class " + affectedClass + " in file "
             + affectedClassInfo.absoluteFile.getPath()

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java
index e68ddf0..f20baab 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java
@@ -157,12 +157,10 @@ public class DescriptorHandler extends HandlerBase {
             return;
         }
 
-        if (getClass().getResource(location) != null) {
-            if (publicId != null) {
-                resourceDTDs.put(publicId, location);
-                owningTask.log("Mapped publicId " + publicId + " to resource "
+        if (getClass().getResource(location) != null && publicId != null) {
+            resourceDTDs.put(publicId, location);
+            owningTask.log("Mapped publicId " + publicId + " to resource "
                     + location, Project.MSG_VERBOSE);
-            }
         }
 
         try {
@@ -383,10 +381,8 @@ public class DescriptorHandler extends HandlerBase {
         }
 
         // Get the value of the <ejb-name> tag.  Only the first occurrence.
-        if (currentElement.equals(EJB_NAME)) {
-            if (ejbName == null) {
-                ejbName = currentText.trim();
-            }
+        if (currentElement.equals(EJB_NAME) && ejbName == null) {
+            ejbName = currentText.trim();
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java
index 33e1251..ef3749f 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java
@@ -468,29 +468,27 @@ public class JonasDeploymentTool extends GenericDeploymentTool {
 
         String baseName = null;
 
-        if (getConfig().namingScheme.getValue().equals(EjbJar.NamingScheme.DESCRIPTOR)) {
+        // try to find JOnAS specific convention name
+        if (getConfig().namingScheme.getValue().equals(EjbJar.NamingScheme.DESCRIPTOR)
+                && !descriptorFileName.contains(getConfig().baseNameTerminator)) {
 
-            // try to find JOnAS specific convention name
-            if (!descriptorFileName.contains(getConfig().baseNameTerminator)) {
-
-                // baseNameTerminator not found: the descriptor use the
-                // JOnAS naming convention, ie [Foo.xml,jonas-Foo.xml] and
-                // not [Foo<baseNameTerminator>-ejb-jar.xml,
-                // Foo<baseNameTerminator>-jonas-ejb-jar.xml].
+            // baseNameTerminator not found: the descriptor use the
+            // JOnAS naming convention, ie [Foo.xml,jonas-Foo.xml] and
+            // not [Foo<baseNameTerminator>-ejb-jar.xml,
+            // Foo<baseNameTerminator>-jonas-ejb-jar.xml].
 
-                String aCanonicalDescriptor = descriptorFileName.replace('\\', '/');
-                int lastSeparatorIndex = aCanonicalDescriptor.lastIndexOf('/');
-                int endOfBaseName;
+            String aCanonicalDescriptor = descriptorFileName.replace('\\', '/');
+            int lastSeparatorIndex = aCanonicalDescriptor.lastIndexOf('/');
+            int endOfBaseName;
 
-                if (lastSeparatorIndex != -1) {
-                    endOfBaseName = descriptorFileName.indexOf(".xml", lastSeparatorIndex);
-                } else {
-                    endOfBaseName = descriptorFileName.indexOf(".xml");
-                }
+            if (lastSeparatorIndex != -1) {
+                endOfBaseName = descriptorFileName.indexOf(".xml", lastSeparatorIndex);
+            } else {
+                endOfBaseName = descriptorFileName.indexOf(".xml");
+            }
 
-                if (endOfBaseName != -1) {
-                    baseName = descriptorFileName.substring(0, endOfBaseName);
-                }
+            if (endOfBaseName != -1) {
+                baseName = descriptorFileName.substring(0, endOfBaseName);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/taskdefs/optional/extension/Extension.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/extension/Extension.java b/src/main/org/apache/tools/ant/taskdefs/optional/extension/Extension.java
index 5f2e7e3..1acb933 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/extension/Extension.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/extension/Extension.java
@@ -190,12 +190,11 @@ public final class Extension {
         if (null == manifest) {
             return new Extension[0];
         }
-        return Stream
-            .concat(Optional.ofNullable(manifest.getMainAttributes())
-                    .map(Stream::of).orElse(Stream.empty()),
+        return Stream.concat(Optional.ofNullable(manifest.getMainAttributes())
+                        .map(Stream::of).orElse(Stream.empty()),
                 manifest.getEntries().values().stream())
-            .map(attrs -> getExtension("", attrs)).filter(Objects::nonNull)
-            .toArray(Extension[]::new);
+                .map(attrs -> getExtension("", attrs)).filter(Objects::nonNull)
+                .toArray(Extension[]::new);
     }
 
     /**
@@ -255,15 +254,13 @@ public final class Extension {
                                  specificationVendor);
         }
 
-        final DeweyDecimal specificationVersion
-            = extension.getSpecificationVersion();
+        final DeweyDecimal specificationVersion = extension.getSpecificationVersion();
         if (null != specificationVersion) {
             attributes.putValue(prefix + SPECIFICATION_VERSION,
                                  specificationVersion.toString());
         }
 
-        final String implementationVendorID
-            = extension.getImplementationVendorID();
+        final String implementationVendorID = extension.getImplementationVendorID();
         if (null != implementationVendorID) {
             attributes.putValue(prefix + IMPLEMENTATION_VENDOR_ID,
                                  implementationVendorID);
@@ -275,8 +272,7 @@ public final class Extension {
                                  implementationVendor);
         }
 
-        final DeweyDecimal implementationVersion
-            = extension.getImplementationVersion();
+        final DeweyDecimal implementationVersion = extension.getImplementationVersion();
         if (null != implementationVersion) {
             attributes.putValue(prefix + IMPLEMENTATION_VERSION,
                                  implementationVersion.toString());
@@ -314,8 +310,7 @@ public final class Extension {
 
         if (null != specificationVersion) {
             try {
-                this.specificationVersion
-                    = new DeweyDecimal(specificationVersion);
+                this.specificationVersion = new DeweyDecimal(specificationVersion);
             } catch (final NumberFormatException nfe) {
                 final String error = "Bad specification version format '"
                     + specificationVersion + "' in '" + extensionName
@@ -423,33 +418,24 @@ public final class Extension {
         }
 
         // Available specification version must be >= required
-        final DeweyDecimal requiredSpecificationVersion
-            = required.getSpecificationVersion();
-        if (null != requiredSpecificationVersion) {
-            if (null == specificationVersion
-                || !isCompatible(specificationVersion, requiredSpecificationVersion)) {
-                return REQUIRE_SPECIFICATION_UPGRADE;
-            }
+        final DeweyDecimal requiredSpecificationVersion = required.getSpecificationVersion();
+        if (null != requiredSpecificationVersion && (null == specificationVersion
+                || !isCompatible(specificationVersion, requiredSpecificationVersion))) {
+            return REQUIRE_SPECIFICATION_UPGRADE;
         }
 
         // Implementation Vendor ID must match
-        final String requiredImplementationVendorID
-            = required.getImplementationVendorID();
-        if (null != requiredImplementationVendorID) {
-            if (null == implementationVendorID
-                || !implementationVendorID.equals(requiredImplementationVendorID)) {
-                return REQUIRE_VENDOR_SWITCH;
-            }
+        final String requiredImplementationVendorID = required.getImplementationVendorID();
+        if (null != requiredImplementationVendorID && (null == implementationVendorID
+                || !implementationVendorID.equals(requiredImplementationVendorID))) {
+            return REQUIRE_VENDOR_SWITCH;
         }
 
         // Implementation version must be >= required
-        final DeweyDecimal requiredImplementationVersion
-            = required.getImplementationVersion();
-        if (null != requiredImplementationVersion) {
-            if (null == implementationVersion
-                || !isCompatible(implementationVersion, requiredImplementationVersion)) {
-                return REQUIRE_IMPLEMENTATION_UPGRADE;
-            }
+        final DeweyDecimal requiredImplementationVersion = required.getImplementationVersion();
+        if (null != requiredImplementationVersion && (null == implementationVersion
+                || !isCompatible(implementationVersion, requiredImplementationVersion))) {
+            return REQUIRE_IMPLEMENTATION_UPGRADE;
         }
 
         // This available optional package satisfies the requirements
@@ -516,8 +502,7 @@ public final class Extension {
      * @param first First version number (dotted decimal)
      * @param second Second version number (dotted decimal)
      */
-    private boolean isCompatible(final DeweyDecimal first,
-                                 final DeweyDecimal second) {
+    private boolean isCompatible(final DeweyDecimal first, final DeweyDecimal second) {
         return first.isGreaterThanOrEqual(second);
     }
 
@@ -530,8 +515,7 @@ public final class Extension {
      *        EXTENSION_LIST or OPTIONAL_EXTENSION_LIST)
      * @return the list of listed extensions
      */
-    private static Extension[] getListed(final Manifest manifest,
-                                          final Attributes.Name listKey) {
+    private static Extension[] getListed(final Manifest manifest, final Attributes.Name listKey) {
         final List<Extension> results = new ArrayList<>();
         final Attributes mainAttributes = manifest.getMainAttributes();
 
@@ -576,8 +560,7 @@ public final class Extension {
      * @param onToken the token
      * @return the resultant array
      */
-    private static String[] split(final String string,
-                                        final String onToken) {
+    private static String[] split(final String string, final String onToken) {
         final StringTokenizer tokenizer = new StringTokenizer(string, onToken);
         final String[] result = new String[tokenizer.countTokens()];
 
@@ -600,8 +583,7 @@ public final class Extension {
      * @param attributes Attributes to searched
      * @return the new Extension object, or null
      */
-    private static Extension getExtension(final String prefix,
-                                          final Attributes attributes) {
+    private static Extension getExtension(final String prefix, final Attributes attributes) {
         //WARNING: We trim the values of all the attributes because
         //Some extension declarations are badly defined (ie have spaces
         //after version or vendorID)

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
index de865ae..7e545e4 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
@@ -1687,13 +1687,12 @@ public class JUnitTask extends Task {
      * @since 1.9.8
      */
     private void checkModules() {
-        if (hasPath(getCommandline().getModulepath())
-                || hasPath(getCommandline().getUpgrademodulepath())) {
-            if (!batchTests.stream().allMatch(BaseTest::getFork)
-                    || !tests.stream().allMatch(BaseTest::getFork)) {
-                throw new BuildException(
+        if ((hasPath(getCommandline().getModulepath())
+                || hasPath(getCommandline().getUpgrademodulepath()))
+                && (!batchTests.stream().allMatch(BaseTest::getFork)
+                || !tests.stream().allMatch(BaseTest::getFork))) {
+            throw new BuildException(
                     "The module path requires fork attribute to be set to true.");
-            }
         }
     }
 
@@ -1943,37 +1942,35 @@ public class JUnitTask extends Task {
     private void createClassLoader() {
         final Path userClasspath = getCommandline().getClasspath();
         final Path userModulepath = getCommandline().getModulepath();
-        if (userClasspath != null || userModulepath != null) {
-            if (reloading || classLoader == null) {
-                deleteClassLoader();
-                final Path path = new Path(getProject());
-                if (userClasspath != null) {
-                    path.add((Path) userClasspath.clone());
-                }
-                if (userModulepath != null && !hasJunit(path)) {
-                    path.add(expandModulePath(userModulepath));
-                }
-                if (includeAntRuntime) {
-                    log("Implicitly adding " + antRuntimeClasses
+        if ((userClasspath != null || userModulepath != null) && (reloading || classLoader == null)) {
+            deleteClassLoader();
+            final Path path = new Path(getProject());
+            if (userClasspath != null) {
+                path.add((Path) userClasspath.clone());
+            }
+            if (userModulepath != null && !hasJunit(path)) {
+                path.add(expandModulePath(userModulepath));
+            }
+            if (includeAntRuntime) {
+                log("Implicitly adding " + antRuntimeClasses
                         + " to CLASSPATH", Project.MSG_VERBOSE);
-                    path.append(antRuntimeClasses);
-                }
-                classLoader = getProject().createClassLoader(path);
-                if (getClass().getClassLoader() != null
+                path.append(antRuntimeClasses);
+            }
+            classLoader = getProject().createClassLoader(path);
+            if (getClass().getClassLoader() != null
                     && getClass().getClassLoader() != Project.class.getClassLoader()) {
-                    classLoader.setParent(getClass().getClassLoader());
-                }
-                classLoader.setParentFirst(false);
-                classLoader.addJavaLibraries();
-                log("Using CLASSPATH " + classLoader.getClasspath(),
-                    Project.MSG_VERBOSE);
-                // make sure the test will be accepted as a TestCase
-                classLoader.addSystemPackageRoot("junit");
-                // make sure the test annotation are accepted
-                classLoader.addSystemPackageRoot("org.junit");
-                // will cause trouble in JDK 1.1 if omitted
-                classLoader.addSystemPackageRoot("org.apache.tools.ant");
+                classLoader.setParent(getClass().getClassLoader());
             }
+            classLoader.setParentFirst(false);
+            classLoader.addJavaLibraries();
+            log("Using CLASSPATH " + classLoader.getClasspath(),
+                    Project.MSG_VERBOSE);
+            // make sure the test will be accepted as a TestCase
+            classLoader.addSystemPackageRoot("junit");
+            // make sure the test annotation are accepted
+            classLoader.addSystemPackageRoot("org.junit");
+            // will cause trouble in JDK 1.1 if omitted
+            classLoader.addSystemPackageRoot("org.apache.tools.ant");
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
index 155e2ed..f977df6 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
@@ -710,26 +710,25 @@ public class FTP extends Task implements FTPTaskConfig {
             boolean candidateFound = false;
             String target = null;
             for (int icounter = 0; icounter < array.length; icounter++) {
-                if (array[icounter] != null && array[icounter].isDirectory()) {
-                    if (!".".equals(array[icounter].getName())
+                if (array[icounter] != null && array[icounter].isDirectory()
+                        && !".".equals(array[icounter].getName())
                         && !"..".equals(array[icounter].getName())) {
-                        candidateFound = true;
-                        target = fiddleName(array[icounter].getName());
-                        getProject().log("will try to cd to "
-                                         + target + " where a directory called " + array[icounter].getName()
-                                         + " exists", Project.MSG_DEBUG);
-                        for (int pcounter = 0; pcounter < array.length; pcounter++) {
-                            if (array[pcounter] != null
+                    candidateFound = true;
+                    target = fiddleName(array[icounter].getName());
+                    getProject().log("will try to cd to "
+                            + target + " where a directory called " + array[icounter].getName()
+                            + " exists", Project.MSG_DEBUG);
+                    for (int pcounter = 0; pcounter < array.length; pcounter++) {
+                        if (array[pcounter] != null
                                 && pcounter != icounter
                                 && target.equals(array[pcounter].getName())) {
-                                candidateFound = false;
-                                break;
-                            }
-                        }
-                        if (candidateFound) {
+                            candidateFound = false;
                             break;
                         }
                     }
+                    if (candidateFound) {
+                        break;
+                    }
                 }
             }
             if (candidateFound) {

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
index 0d877aa..8ae95d6 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
@@ -611,26 +611,25 @@ public class FTPTaskMirrorImpl implements FTPTaskMirror {
             boolean candidateFound = false;
             String target = null;
             for (int icounter = 0; icounter < array.length; icounter++) {
-                if (array[icounter] != null && array[icounter].isDirectory()) {
-                    if (!".".equals(array[icounter].getName())
+                if (array[icounter] != null && array[icounter].isDirectory()
+                        && !".".equals(array[icounter].getName())
                         && !"..".equals(array[icounter].getName())) {
-                        candidateFound = true;
-                        target = fiddleName(array[icounter].getName());
-                        task.log("will try to cd to "
-                                         + target + " where a directory called " + array[icounter].getName()
-                                         + " exists", Project.MSG_DEBUG);
-                        for (int pcounter = 0; pcounter < array.length; pcounter++) {
-                            if (array[pcounter] != null
+                    candidateFound = true;
+                    target = fiddleName(array[icounter].getName());
+                    task.log("will try to cd to "
+                            + target + " where a directory called " + array[icounter].getName()
+                            + " exists", Project.MSG_DEBUG);
+                    for (int pcounter = 0; pcounter < array.length; pcounter++) {
+                        if (array[pcounter] != null
                                 && pcounter != icounter
                                 && target.equals(array[pcounter].getName())) {
-                                candidateFound = false;
-                                break;
-                            }
-                        }
-                        if (candidateFound) {
+                            candidateFound = false;
                             break;
                         }
                     }
+                    if (candidateFound) {
+                        break;
+                    }
                 }
             }
             if (candidateFound) {
@@ -1298,12 +1297,10 @@ public class FTPTaskMirrorImpl implements FTPTaskMirror {
         if (i >= 0) {
             String cwd = ftp.printWorkingDirectory();
             String parent = dir.getParent();
-            if (parent != null) {
-                if (!ftp.changeWorkingDirectory(resolveFile(parent))) {
-                    throw new BuildException(
+            if (parent != null && !ftp.changeWorkingDirectory(resolveFile(parent))) {
+                throw new BuildException(
                         "could not change to directory: %s",
                         ftp.getReplyString());
-                }
             }
 
             while (i >= 0) {

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java
index 8c1ccf9..59e53a0 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java
@@ -134,10 +134,8 @@ public class ScpFromMessageBySftp extends ScpFromMessage {
                         final String remoteFile,
                         final File localFile) throws SftpException {
         String pwd = remoteFile;
-        if (remoteFile.lastIndexOf('/') != -1) {
-            if (remoteFile.length() > 1) {
-                pwd = remoteFile.substring(0, remoteFile.lastIndexOf('/'));
-            }
+        if (remoteFile.lastIndexOf('/') != -1 && remoteFile.length() > 1) {
+            pwd = remoteFile.substring(0, remoteFile.lastIndexOf('/'));
         }
         channel.cd(pwd);
         if (!localFile.exists()) {
@@ -168,10 +166,8 @@ public class ScpFromMessageBySftp extends ScpFromMessage {
         if (!localFile.exists()) {
             final String path = localFile.getAbsolutePath();
             final int i = path.lastIndexOf(File.pathSeparator);
-            if (i != -1) {
-                if (path.length() > File.pathSeparator.length()) {
-                    new File(path.substring(0, i)).mkdirs();
-                }
+            if (i != -1 && path.length() > File.pathSeparator.length()) {
+                new File(path.substring(0, i)).mkdirs();
             }
         }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/types/resources/URLResource.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/resources/URLResource.java b/src/main/org/apache/tools/ant/types/resources/URLResource.java
index 3328356..54a0f26 100644
--- a/src/main/org/apache/tools/ant/types/resources/URLResource.java
+++ b/src/main/org/apache/tools/ant/types/resources/URLResource.java
@@ -145,17 +145,15 @@ public class URLResource extends Resource implements URLProvider {
         if (isReference()) {
             return ((URLResource) getCheckedRef()).getURL();
         }
-        if (url == null) {
-            if (baseURL != null) {
-                if (relPath == null) {
-                    throw new BuildException("must provide relativePath"
-                                             + " attribute when using baseURL.");
-                }
-                try {
-                    url = new URL(baseURL, relPath);
-                } catch (MalformedURLException e) {
-                    throw new BuildException(e);
-                }
+        if (url == null && baseURL != null) {
+            if (relPath == null) {
+                throw new BuildException("must provide relativePath"
+                        + " attribute when using baseURL.");
+            }
+            try {
+                url = new URL(baseURL, relPath);
+            } catch (MalformedURLException e) {
+                throw new BuildException(e);
             }
         }
         return url;

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/util/GlobPatternMapper.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/GlobPatternMapper.java b/src/main/org/apache/tools/ant/util/GlobPatternMapper.java
index 90dc037..0b272fb 100644
--- a/src/main/org/apache/tools/ant/util/GlobPatternMapper.java
+++ b/src/main/org/apache/tools/ant/util/GlobPatternMapper.java
@@ -198,10 +198,8 @@ public class GlobPatternMapper implements FileNameMapper {
         if (!caseSensitive) {
             name = name.toLowerCase();
         }
-        if (handleDirSep) {
-            if (name.contains("\\")) {
-                name = name.replace('\\', '/');
-            }
+        if (handleDirSep && name.contains("\\")) {
+            name = name.replace('\\', '/');
         }
         return name;
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java b/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
index 27a2205..e463a7d 100644
--- a/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
+++ b/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
@@ -294,11 +294,9 @@ public class LayoutPreservingProperties extends Properties {
         boolean writtenSep = false;
         for (LogicalLine line : logicalLines.subList(skipLines, totalLines)) {
             if (line instanceof Pair) {
-                if (((Pair) line).isNew()) {
-                    if (!writtenSep) {
-                        osw.write(eol);
-                        writtenSep = true;
-                    }
+                if (((Pair) line).isNew() && !writtenSep) {
+                    osw.write(eol);
+                    writtenSep = true;
                 }
                 osw.write(line.toString() + eol);
             } else if (line != null) {

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java b/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java
index 98330a2..9b4942d 100644
--- a/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java
+++ b/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java
@@ -118,13 +118,10 @@ public class RegexpPatternMapper implements FileNameMapper {
         if (sourceFileName == null) {
             return null;
         }
-        if (handleDirSep) {
-            if (sourceFileName.contains("\\")) {
-                sourceFileName = sourceFileName.replace('\\', '/');
-            }
+        if (handleDirSep && sourceFileName.contains("\\")) {
+            sourceFileName = sourceFileName.replace('\\', '/');
         }
-        if (reg == null  || to == null
-            || !reg.matches(sourceFileName, regexpOptions)) {
+        if (reg == null || to == null || !reg.matches(sourceFileName, regexpOptions)) {
             return null;
         }
         return new String[] {replaceReferences(sourceFileName)};

http://git-wip-us.apache.org/repos/asf/ant/blob/2b699eb6/src/main/org/apache/tools/tar/TarBuffer.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/tar/TarBuffer.java b/src/main/org/apache/tools/tar/TarBuffer.java
index d7f0eca..e8b68d1 100644
--- a/src/main/org/apache/tools/tar/TarBuffer.java
+++ b/src/main/org/apache/tools/tar/TarBuffer.java
@@ -282,11 +282,9 @@ public class TarBuffer {
             offset += numBytes;
             bytesNeeded -= numBytes;
 
-            if (numBytes != blockSize) {
-                if (debug) {
-                    System.err.printf("ReadBlock: INCOMPLETE READ %d of %d bytes read.%n",
-                            numBytes, blockSize);
-                }
+            if (numBytes != blockSize && debug) {
+                System.err.printf("ReadBlock: INCOMPLETE READ %d of %d bytes read.%n",
+                        numBytes, blockSize);
             }
         }
 
@@ -322,8 +320,7 @@ public class TarBuffer {
      */
     public void writeRecord(byte[] record) throws IOException {
         if (debug) {
-            System.err.printf("WriteRecord: recIdx = %d blkIdx = %d%n",
-                    currRecIdx, currBlkIdx);
+            System.err.printf("WriteRecord: recIdx = %d blkIdx = %d%n", currRecIdx, currBlkIdx);
         }
 
         if (outStream == null) {