diff --git a/src/main/org/apache/tools/ant/taskdefs/Cvs.java b/src/main/org/apache/tools/ant/taskdefs/Cvs.java index 068b4a558..27e337f00 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Cvs.java +++ b/src/main/org/apache/tools/ant/taskdefs/Cvs.java @@ -229,7 +229,9 @@ public class Cvs extends Task { null); exe.setAntRun(project); - if (dest == null) dest = project.getBaseDir(); + if (dest == null) { + dest = project.getBaseDir(); + } exe.setWorkingDirectory(dest); exe.setCommandline(toExecute.getCommandline()); @@ -237,8 +239,9 @@ public class Cvs extends Task { try { int retCode = exe.execute(); /*Throw an exception if cvs exited with error. (Iulian)*/ - if(failOnError && retCode != 0) + if(failOnError && retCode != 0) { throw new BuildException("cvs exited with error code "+ retCode); + } } catch (IOException e) { throw new BuildException(e, location); } finally { @@ -258,8 +261,9 @@ public class Cvs extends Task { public void setCvsRoot(String root) { // Check if not real cvsroot => set it to null if (root != null) { - if (root.trim().equals("")) + if (root.trim().equals("")) { root = null; + } } this.cvsRoot = root; @@ -268,8 +272,9 @@ public class Cvs extends Task { public void setCvsRsh(String rsh) { // Check if not real cvsrsh => set it to null if (rsh != null) { - if (rsh.trim().equals("")) + if (rsh.trim().equals("")) { rsh = null; + } } this.cvsRsh = rsh; diff --git a/src/main/org/apache/tools/ant/taskdefs/Delete.java b/src/main/org/apache/tools/ant/taskdefs/Delete.java index dd18ae2f9..7de3676f9 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Delete.java +++ b/src/main/org/apache/tools/ant/taskdefs/Delete.java @@ -266,11 +266,12 @@ public class Delete extends MatchingTask { if (!file.delete()) { String message="Unable to delete file " + file.getAbsolutePath(); - if(failonerror) + if(failonerror) { throw new BuildException(message); - else + } else { log(message, quiet ? Project.MSG_VERBOSE : Project.MSG_WARN); + } } } } else { @@ -337,7 +338,9 @@ public class Delete extends MatchingTask { protected void removeDir(File d) { String[] list = d.list(); - if (list == null) list = new String[0]; + if (list == null) { + list = new String[0]; + } for (int i = 0; i < list.length; i++) { String s = list[i]; File f = new File(d, s); @@ -347,22 +350,24 @@ public class Delete extends MatchingTask { log("Deleting " + f.getAbsolutePath(), verbosity); if (!f.delete()) { String message="Unable to delete file " + f.getAbsolutePath(); - if(failonerror) + if(failonerror) { throw new BuildException(message); - else + } else { log(message, quiet ? Project.MSG_VERBOSE : Project.MSG_WARN); + } } } } log("Deleting directory " + d.getAbsolutePath(), verbosity); if (!d.delete()) { String message="Unable to delete directory " + dir.getAbsolutePath(); - if(failonerror) + if(failonerror) { throw new BuildException(message); - else + } else { log(message, quiet ? Project.MSG_VERBOSE : Project.MSG_WARN); + } } } @@ -381,9 +386,9 @@ public class Delete extends MatchingTask { log("Deleting " + f.getAbsolutePath(), verbosity); if (!f.delete()) { String message="Unable to delete file " + f.getAbsolutePath(); - if(failonerror) + if(failonerror) { throw new BuildException(message); - else + } else log(message, quiet ? Project.MSG_VERBOSE : Project.MSG_WARN); } @@ -391,7 +396,8 @@ public class Delete extends MatchingTask { } if (dirs.length > 0 && includeEmpty) { - int dirCount = 0; + in + }t dirCount = 0; for (int j=dirs.length-1; j>=0; j--) { File dir = new File(d, dirs[j]); String[] dirFiles = dir.list(); @@ -400,11 +406,12 @@ public class Delete extends MatchingTask { if (!dir.delete()) { String message="Unable to delete directory " + dir.getAbsolutePath(); - if(failonerror) + if(failonerror) { throw new BuildException(message); - else + } else { { log(message, quiet ? Project.MSG_VERBOSE : Project.MSG_WARN); + } } else { dirCount++; } diff --git a/src/main/org/apache/tools/ant/taskdefs/Exec.java b/src/main/org/apache/tools/ant/taskdefs/Exec.java index e040ea8bc..79e63c097 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Exec.java +++ b/src/main/org/apache/tools/ant/taskdefs/Exec.java @@ -102,7 +102,9 @@ public class Exec extends Task { } // default directory to the project's base directory - if (dir == null) dir = project.getBaseDir(); + if (dir == null) { + dir = project.getBaseDir(); + } if (myos.toLowerCase().indexOf("windows") >= 0) { if (!dir.equals(project.resolveFile("."))) { @@ -121,7 +123,9 @@ public class Exec extends Task { } } else { String ant = project.getProperty("ant.home"); - if (ant == null) throw new BuildException("Property 'ant.home' not found", location); + if (ant == null) { + throw new BuildException("Property 'ant.home' not found", location); + } String antRun = project.resolveFile(ant + "/bin/antRun").toString(); command = antRun + " " + dir + " " + command; @@ -203,7 +207,9 @@ public class Exec extends Task { } protected void logFlush() { - if (fos != null) fos.close(); + if (fos != null) { + fos.close(); + } } // Inner class for continually pumping the input stream during diff --git a/src/main/org/apache/tools/ant/taskdefs/Get.java b/src/main/org/apache/tools/ant/taskdefs/Get.java index e8d4c85b7..35294a954 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Get.java +++ b/src/main/org/apache/tools/ant/taskdefs/Get.java @@ -189,8 +189,9 @@ public class Get extends Task { } if( is==null ) { log( "Can't get " + source + " to " + dest); - if(ignoreErrors) + if(ignoreErrors) { return; + } throw new BuildException( "Can't get " + source + " to " + dest, location); } @@ -200,9 +201,13 @@ public class Get extends Task { while ((length = is.read(buffer)) >= 0) { fos.write(buffer, 0, length); - if (verbose) System.out.print("."); + if (verbose) { + System.out.print("."); + } + } + if(verbose) { + System.out.println(); } - if(verbose) System.out.println(); fos.close(); is.close(); @@ -215,13 +220,15 @@ public class Get extends Task { log("last modified = "+t.toString() +((remoteTimestamp==0)?" - using current time instead":"")); } - if(remoteTimestamp!=0) + if(remoteTimestamp!=0) { touchFile(dest,remoteTimestamp); + } } } catch (IOException ioe) { log("Error getting " + source + " to " + dest ); - if(ignoreErrors) + if(ignoreErrors) { return; + } throw new BuildException(ioe, location); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java index d31c689b1..cb6c14084 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java @@ -182,8 +182,9 @@ public class Ilasm if(targetType.equals("exe") || targetType.equals("library")) { _targetType=targetType; } - else + else { throw new BuildException("targetType " +targetType+" is not a valid type"); + } } /** @@ -201,15 +202,17 @@ public class Ilasm */ protected String getTargetTypeParameter() { - if(!notEmpty(_targetType)) + if(!notEmpty(_targetType)) { return null; - if (_targetType.equals("exe")) + } + if (_targetType.equals("exe")) { return "/exe"; - else - if (_targetType.equals("library")) + } else + if (_targetType.equals("library")) { return "/dll"; - else + } else { return null; + } } @@ -292,8 +295,9 @@ public class Ilasm * @return the argument string or null for no argument */ protected String getOutputFileParameter() { - if (_outputFile==null || _outputFile.length()==0) + if (_outputFile==null || _outputFile.length()==0) { return null; + } File f = _outputFile; return "/output="+f.toString(); } @@ -369,10 +373,11 @@ public class Ilasm /** get the argument or null for no argument needed */ protected String getKeyfileParameter() { - if(_keyfile!=null) + if(_keyfile!=null) { return "/keyfile:"+_keyfile.toString(); - else + } else { return null; + } } /** any extra command options? @@ -401,10 +406,11 @@ public class Ilasm * @return The ExtraOptions Parameter to CSC */ protected String getExtraOptionsParameter() { - if (_extraOptions!=null && _extraOptions.length()!=0) + if (_extraOptions!=null && _extraOptions.length()!=0) { return _extraOptions; - else + } else { return null; + } } @@ -414,8 +420,9 @@ public class Ilasm */ public void execute() throws BuildException { - if (_srcDir == null) + if (_srcDir == null) { _srcDir=project.resolveFile("."); + } //get dependencies list. DirectoryScanner scanner = super.getDirectoryScanner(_srcDir); 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 4ba421c44..fa842335b 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 @@ -638,8 +638,9 @@ public class FTP { File file = project.resolveFile(new File(dir, filename).getPath()); - if (newerOnly && isUpToDate(ftp, file, resolveFile(filename))) + if (newerOnly && isUpToDate(ftp, file, resolveFile(filename))) { return; + } if (verbose) { @@ -729,8 +730,9 @@ public class FTP { File file = project.resolveFile(new File(dir, filename).getPath()); - if (newerOnly && isUpToDate(ftp, file, resolveFile(filename))) + if (newerOnly && isUpToDate(ftp, file, resolveFile(filename))) { return; + } if (verbose) { diff --git a/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java b/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java index bc404f5b5..6c3295a96 100644 --- a/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java +++ b/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java @@ -194,12 +194,13 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { String stubVersion = attributes.getStubVersion(); if (null != stubVersion) { - if ("1.1".equals(stubVersion)) + if ("1.1".equals(stubVersion)) { cmd.createArgument().setValue("-v1.1"); - else if ("1.2".equals(stubVersion)) + } else if ("1.2".equals(stubVersion)) { cmd.createArgument().setValue("-v1.2"); - else + } else { cmd.createArgument().setValue("-vcompat"); + } } if (null != attributes.getSourceBase()) { diff --git a/src/main/org/apache/tools/ant/types/Commandline.java b/src/main/org/apache/tools/ant/types/Commandline.java index 97ee1a50d..e997e093c 100644 --- a/src/main/org/apache/tools/ant/types/Commandline.java +++ b/src/main/org/apache/tools/ant/types/Commandline.java @@ -205,7 +205,9 @@ public class Commandline implements Cloneable { * Sets the executable to run. */ public void setExecutable(String executable) { - if (executable == null || executable.length() == 0) return; + if (executable == null || executable.length() == 0) { + return; + } this.executable = executable.replace('/', File.separatorChar) .replace('\\', File.separatorChar); } @@ -227,7 +229,9 @@ public class Commandline implements Cloneable { */ public String[] getCommandline() { final String[] args = getArguments(); - if (executable == null) return args; + if (executable == null) { + return args; + } final String[] result = new String[args.length+1]; result[0] = executable; System.arraycopy(args, 0, result, 1, args.length); @@ -285,7 +289,9 @@ public class Commandline implements Cloneable { public static String toString(String [] line) { // empty path return empty string - if (line == null || line.length == 0) return ""; + if (line == null || line.length == 0) { + return ""; + } // path containing one or more elements final StringBuffer result = new StringBuffer();