sbailliez    02/01/08 12:21:59

  Modified:    src/main/org/apache/tools/ant/taskdefs Cvs.java Get.java
                        Exec.java Delete.java
               src/main/org/apache/tools/ant/taskdefs/rmic
                        DefaultRmicAdapter.java
               src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
               src/main/org/apache/tools/ant/taskdefs/optional/dotnet
                        Ilasm.java
               src/main/org/apache/tools/ant/types Commandline.java
  Log:
  Fix bad coding style.
  then/else parts of if statement and loop body must always been enclosed
  in a block statement.
  
  Revision  Changes    Path
  1.19      +9 -4      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Cvs.java
  
  Index: Cvs.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Cvs.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Cvs.java  29 Dec 2001 19:46:45 -0000      1.18
  +++ Cvs.java  8 Jan 2002 20:21:58 -0000       1.19
  @@ -229,7 +229,9 @@
                                     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 @@
           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 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 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;
  
  
  
  1.12      +12 -5     
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Get.java
  
  Index: Get.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Get.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Get.java  27 Nov 2001 18:04:52 -0000      1.11
  +++ Get.java  8 Jan 2002 20:21:58 -0000       1.12
  @@ -189,8 +189,9 @@
               }
               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 @@
   
               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 @@
                       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);
           }
       }
  
  
  
  1.22      +9 -3      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Exec.java
  
  Index: Exec.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Exec.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- Exec.java 16 Nov 2001 22:59:16 -0000      1.21
  +++ Exec.java 8 Jan 2002 20:21:58 -0000       1.22
  @@ -102,7 +102,9 @@
           }
   
           // 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 @@
               }
           } 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 @@
       }
   
       protected void logFlush() {
  -        if (fos != null) fos.close();
  +        if (fos != null) {
  +          fos.close();
  +        }
       }
   
       // Inner class for continually pumping the input stream during
  
  
  
  1.20      +19 -12    
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Delete.java
  
  Index: Delete.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Delete.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Delete.java       28 Oct 2001 21:26:29 -0000      1.19
  +++ Delete.java       8 Jan 2002 20:21:58 -0000       1.20
  @@ -266,11 +266,12 @@
   
                       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 @@
   
       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 @@
                   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 @@
                   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 @@
           }
   
           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 @@
                       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++;
                       }
  
  
  
  1.12      +4 -3      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java
  
  Index: DefaultRmicAdapter.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- DefaultRmicAdapter.java   21 Dec 2001 22:25:58 -0000      1.11
  +++ DefaultRmicAdapter.java   8 Jan 2002 20:21:58 -0000       1.12
  @@ -194,12 +194,13 @@
   
           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()) {
  
  
  
  1.15      +4 -2      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- FTP.java  5 Dec 2001 02:06:57 -0000       1.14
  +++ FTP.java  8 Jan 2002 20:21:58 -0000       1.15
  @@ -638,8 +638,9 @@
           {
               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 @@
           {
               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)
               {
  
  
  
  1.9       +19 -12    
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java
  
  Index: Ilasm.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Ilasm.java        28 Oct 2001 21:30:20 -0000      1.8
  +++ Ilasm.java        8 Jan 2002 20:21:58 -0000       1.9
  @@ -182,8 +182,9 @@
           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 @@
       */
   
       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 @@
        * @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 @@
       /** 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 @@
        * @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 void execute() 
           throws BuildException {
  -        if (_srcDir == null)
  +        if (_srcDir == null) {
                   _srcDir=project.resolveFile(".");
  +        }
       
           //get dependencies list. 
           DirectoryScanner scanner = super.getDirectoryScanner(_srcDir);
  
  
  
  1.17      +9 -3      
jakarta-ant/src/main/org/apache/tools/ant/types/Commandline.java
  
  Index: Commandline.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/Commandline.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Commandline.java  5 Nov 2001 15:19:21 -0000       1.16
  +++ Commandline.java  8 Jan 2002 20:21:58 -0000       1.17
  @@ -205,7 +205,9 @@
        * 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 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 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();
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to