ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sbaill...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/types Substitution.java
Date Tue, 08 Jan 2002 19:59:45 GMT
sbailliez    02/01/08 11:59:45

  Modified:    src/main/org/apache/tools/ant/taskdefs SQLExec.java Tar.java
                        UpToDate.java SignJar.java
               src/main/org/apache/tools/ant/taskdefs/optional/starteam
                        TreeBasedTask.java
               src/main/org/apache/tools/ant/taskdefs/optional/net
                        TelnetTask.java
               src/main/org/apache/tools/ant/taskdefs/optional
                        TraXLiaison.java AdaptxLiaison.java Rpm.java
                        Script.java
               src/main/org/apache/tools/ant/taskdefs/optional/perforce
                        SimpleP4OutputHandler.java
               src/main/org/apache/tools/ant/types Substitution.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.30      +20 -7     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
  
  Index: SQLExec.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/SQLExec.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- SQLExec.java	22 Dec 2001 00:02:20 -0000	1.29
  +++ SQLExec.java	8 Jan 2002 19:59:44 -0000	1.30
  @@ -495,7 +495,9 @@
                   throw new SQLException("No suitable Driver for "+url);
               }
   
  -            if (!isValidRdbms(conn)) return;
  +            if (!isValidRdbms(conn)) {
  +              return;
  +            }
   
               conn.setAutoCommit(autocommit);
   
  @@ -566,8 +568,12 @@
               while ((line=in.readLine()) != null){
                   line = line.trim();
                   line = project.replaceProperties(line);
  -                if (line.startsWith("//")) continue;
  -                if (line.startsWith("--")) continue;
  +                if (line.startsWith("//")) {
  +                  continue;
  +                }
  +                if (line.startsWith("--")) {
  +                  continue;
  +                }
                   StringTokenizer st = new StringTokenizer(line);
                   if (st.hasMoreTokens()) {
                       String token = st.nextToken();
  @@ -582,7 +588,9 @@
                   // SQL defines "--" as a comment to EOL
                   // and in Oracle it may contain a hint
                   // so we cannot just remove it, instead we must end it
  -                if (line.indexOf("--") >= 0) sql += "\n";
  +                if (line.indexOf("--") >= 0) {
  +                  sql += "\n";
  +                }
   
                   if (delimiterType.equals(DelimiterType.NORMAL) && sql.endsWith(delimiter)
||
                       delimiterType.equals(DelimiterType.ROW) && line.equals(delimiter))
{
  @@ -606,8 +614,9 @@
        * Verify if connected to the correct RDBMS
        **/
       protected boolean isValidRdbms(Connection conn) {
  -        if (rdbms == null && version == null)
  +        if (rdbms == null && version == null) {
               return true;
  +        }
           
           try {
               DatabaseMetaData dmd = conn.getMetaData();
  @@ -648,7 +657,9 @@
        */
       protected void execSQL(String sql, PrintStream out) throws SQLException {
           // Check and ignore empty statements
  -        if ("".equals(sql.trim())) return;
  +        if ("".equals(sql.trim())) {
  +          return;
  +        }
           
           try {  
               totalSql++;
  @@ -672,7 +683,9 @@
           }
           catch (SQLException e) {
               log("Failed to execute: " + sql, Project.MSG_ERR);
  -            if (!onError.equals("continue")) throw e;
  +            if (!onError.equals("continue")) {
  +              throw e;
  +            }
               log(e.toString(), Project.MSG_ERR);
           }
       }
  
  
  
  1.20      +2 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Tar.java
  
  Index: Tar.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Tar.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Tar.java	5 Dec 2001 01:15:57 -0000	1.19
  +++ Tar.java	8 Jan 2002 19:59:44 -0000	1.20
  @@ -333,8 +333,9 @@
   
               tOut.closeEntry();
           } finally {
  -            if (fIn != null)
  +            if (fIn != null) {
                   fIn.close();
  +            }
           }
       }
   
  
  
  
  1.9       +3 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/UpToDate.java
  
  Index: UpToDate.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/UpToDate.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- UpToDate.java	28 Oct 2001 21:26:29 -0000	1.8
  +++ UpToDate.java	8 Jan 2002 19:59:44 -0000	1.9
  @@ -155,7 +155,9 @@
           }
   
           // if not there then it can't be up to date
  -        if (_targetFile != null && !_targetFile.exists()) return false; 
  +        if (_targetFile != null && !_targetFile.exists()) {
  +          return false;
  +        } 
   
           Enumeration enum = sourceFileSets.elements();
           boolean upToDate = true;
  
  
  
  1.12      +14 -5     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/SignJar.java
  
  Index: SignJar.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/SignJar.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SignJar.java	16 Nov 2001 09:54:47 -0000	1.11
  +++ SignJar.java	8 Jan 2002 19:59:44 -0000	1.12
  @@ -199,7 +199,9 @@
               throw new BuildException("storepass attribute must be set");
           }
   
  -        if(isUpToDate(jarSource, jarTarget)) return;
  +        if(isUpToDate(jarSource, jarTarget)) {
  +          return;
  +        }
   
           final StringBuffer sb = new StringBuffer();
   
  @@ -265,11 +267,18 @@
   
           if( null != signedjarFile ) {
   
  -            if(!jarFile.exists()) return false;
  -            if(!signedjarFile.exists()) return false;
  -            if(jarFile.equals(signedjarFile)) return false;
  -            if(signedjarFile.lastModified() > jarFile.lastModified())
  +            if(!jarFile.exists()) {
  +              return false;
  +            }
  +            if(!signedjarFile.exists()) {
  +              return false;
  +            }
  +            if(jarFile.equals(signedjarFile)) {
  +              return false;
  +            }
  +            if(signedjarFile.lastModified() > jarFile.lastModified()) {
                   return true;
  +            }
           } else {
               if( lazy ) {
                   return isSigned(jarFile);
  
  
  
  1.3       +2 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/starteam/TreeBasedTask.java
  
  Index: TreeBasedTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/starteam/TreeBasedTask.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TreeBasedTask.java	31 Dec 2001 20:15:57 -0000	1.2
  +++ TreeBasedTask.java	8 Jan 2002 19:59:44 -0000	1.3
  @@ -434,8 +434,9 @@
           if (null != this.label) {
               Label[] allLabels = v.getLabels();
               for (int i = 0; i < allLabels.length; i++) {
  -                if (allLabels[i].getName().equals(this.label))
  +                if (allLabels[i].getName().equals(this.label)) {
                       return allLabels[i].getID();
  +                }
               }
               throw new BuildException("Error: label "
                       + this.label
  
  
  
  1.7       +19 -10    jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java
  
  Index: TelnetTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TelnetTask.java	26 Dec 2001 20:37:48 -0000	1.6
  +++ TelnetTask.java	8 Jan 2002 19:59:44 -0000	1.7
  @@ -70,7 +70,7 @@
    * Class to provide automated telnet protocol support for the Ant build tool
    *
    * @author <a href="mailto:ScottCarlson@email.com">ScottCarlson@email.com</a>
  - * @version $Revision: 1.6 $
  + * @version $Revision: 1.7 $
    */
   
   public class TelnetTask extends Task {
  @@ -123,15 +123,18 @@
       public void execute() throws BuildException 
       {
          /**  A server name is required to continue */
  -       if (server== null)
  +       if (server== null) {
              throw new BuildException("No Server Specified");
  +       }
          /**  A userid and password must appear together 
           *   if they appear.  They are not required.
           */
  -       if (userid == null && password != null)
  +       if (userid == null && password != null) {
              throw new BuildException("No Userid Specified");
  -       if (password == null && userid != null)
  +       }
  +       if (password == null && userid != null) {
              throw new BuildException("No Password Specified");
  +       }
   
          /**  Create the telnet client object */
          telnet = new AntTelnetClient();
  @@ -141,15 +144,17 @@
              throw new BuildException("Can't connect to "+server);
          }
          /**  Login if userid and password were specified */
  -       if (userid != null && password != null)
  +       if (userid != null && password != null) {
             login();
  +       }
          /**  Process each sub command */
          Enumeration tasksToRun = telnetTasks.elements();
          while (tasksToRun!=null && tasksToRun.hasMoreElements())
          {
              TelnetSubTask task = (TelnetSubTask) tasksToRun.nextElement();
  -           if (task instanceof TelnetRead && defaultTimeout != null)
  +           if (task instanceof TelnetRead && defaultTimeout != null) {
                  ((TelnetRead)task).setDefaultTimeout(defaultTimeout);
  +           }
              task.execute(telnet);
          }
       }
  @@ -160,8 +165,9 @@
        */
       private void login()
       {
  -       if (addCarriageReturn)
  +       if (addCarriageReturn) {
             telnet.sendString("\n", true);
  +       }
          telnet.waitForString("ogin:");
          telnet.sendString(userid, true);
          telnet.waitForString("assword:");
  @@ -287,8 +293,9 @@
            */
           public void setDefaultTimeout(Integer defaultTimeout)
           {
  -           if (timeout == null)
  +           if (timeout == null) {
                 timeout = defaultTimeout;
  +           }
       }
       }
       /**
  @@ -336,8 +343,9 @@
                            is.available() == 0) {
                         Thread.sleep(250);
                     }
  -                  if (is.available() == 0)
  +                  if (is.available() == 0) {
                         throw new BuildException("Response Timed-Out", getLocation());
  +                  }
                     sb.append((char) is.read());
                 }
             }
  @@ -361,8 +369,9 @@
           OutputStream os =this.getOutputStream();
           try {
             os.write((s + "\n").getBytes());
  -          if (echoString)
  +          if (echoString) {
                 log(s, Project.MSG_INFO);
  +          }
             os.flush();
           } catch (Exception e)
           { 
  
  
  
  1.8       +3 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
  
  Index: TraXLiaison.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TraXLiaison.java	7 Dec 2001 16:10:17 -0000	1.7
  +++ TraXLiaison.java	8 Jan 2002 19:59:44 -0000	1.8
  @@ -196,7 +196,9 @@
           if(e.getLocator() != null) {
               if(e.getLocator().getSystemId() != null) {
                   String url = e.getLocator().getSystemId();
  -                if(url.startsWith("file:///")) url = url.substring(8);
  +                if(url.startsWith("file:///")) {
  +                  url = url.substring(8);
  +                }
                   msg.append(url);
               } else {
                   msg.append("Unknown file");
  
  
  
  1.3       +3 -2      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/AdaptxLiaison.java
  
  Index: AdaptxLiaison.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/AdaptxLiaison.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AdaptxLiaison.java	26 Nov 2001 18:10:45 -0000	1.2
  +++ AdaptxLiaison.java	8 Jan 2002 19:59:44 -0000	1.3
  @@ -68,7 +68,7 @@
   /**
    *
    * @author <a href="mailto:blandin@intalio.com">Arnaud Blandin</a>
  - * @version $Revision: 1.2 $ $Date: 2001/11/26 18:10:45 $
  + * @version $Revision: 1.3 $ $Date: 2002/01/08 19:59:44 $
    */
   public class AdaptxLiaison implements XSLTLiaison {
   
  @@ -95,8 +95,9 @@
       }
   
       public void setOutputtype(String type) throws Exception {
  -        if (!type.equals("xml")) 
  +        if (!type.equals("xml")) { 
               throw new BuildException("Unsupported output type: " + type);
  +        }
       }
   
   } //-- AdaptxLiaison
  
  
  
  1.3       +3 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java
  
  Index: Rpm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Rpm.java	28 Oct 2001 21:30:18 -0000	1.2
  +++ Rpm.java	8 Jan 2002 19:59:44 -0000	1.3
  @@ -173,7 +173,9 @@
           Execute exe = new Execute(streamhandler, null);
   
           exe.setAntRun(project);
  -        if (topDir == null) topDir = project.getBaseDir();
  +        if (topDir == null) {
  +          topDir = project.getBaseDir();
  +        }
           exe.setWorkingDirectory(topDir);
   
           exe.setCommandline(toExecute.getCommandline());
  
  
  
  1.9       +7 -3      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/Script.java
  
  Index: Script.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/Script.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Script.java	28 Oct 2001 21:30:18 -0000	1.8
  +++ Script.java	8 Jan 2002 19:59:44 -0000	1.9
  @@ -83,10 +83,13 @@
               boolean isValid = key.length()>0 &&
                   Character.isJavaIdentifierStart(key.charAt(0));
   
  -            for (int i=1; isValid && i<key.length(); i++)
  +            for (int i=1; isValid && i<key.length(); i++) {
                   isValid = Character.isJavaIdentifierPart(key.charAt(i));
  +            }
   
  -            if (isValid) beans.put(key, dictionary.get(key));
  +            if (isValid) {
  +              beans.put(key, dictionary.get(key));
  +            }
           }
       }
   
  @@ -146,8 +149,9 @@
        */
       public void setSrc(String fileName) {
           File file = new File(fileName);
  -        if (!file.exists()) 
  +        if (!file.exists()) { 
               throw new BuildException("file " + fileName + " not found.");
  +        }
   
           int count = (int)file.length();
           byte data[] = new byte[count];
  
  
  
  1.5       +3 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java
  
  Index: SimpleP4OutputHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SimpleP4OutputHandler.java	27 Nov 2001 18:04:53 -0000	1.4
  +++ SimpleP4OutputHandler.java	8 Jan 2002 19:59:45 -0000	1.5
  @@ -69,7 +69,9 @@
       }
   
       public void process(String line) throws BuildException {
  -        if(parent.util.match("/^exit/",line)) return;
  +        if(parent.util.match("/^exit/",line)) {
  +          return;
  +        }
   
           //Throw exception on errors (except up-to-date)
           //p4 -s is unpredicatable. For example a server down
  
  
  
  1.4       +2 -1      jakarta-ant/src/main/org/apache/tools/ant/types/Substitution.java
  
  Index: Substitution.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/Substitution.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Substitution.java	6 Nov 2001 11:08:34 -0000	1.3
  +++ Substitution.java	8 Jan 2002 19:59:45 -0000	1.4
  @@ -93,8 +93,9 @@
        */
       public String getExpression(Project p)
       {
  -        if (isReference())
  +        if (isReference()) {
               return getRef(p).getExpression(p);
  +        }
   
           return expression;
       }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message