Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@apache.org Received: (qmail 63196 invoked from network); 8 Jan 2002 19:59:55 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 8 Jan 2002 19:59:55 -0000 Received: (qmail 21864 invoked by uid 97); 8 Jan 2002 19:59:52 -0000 Delivered-To: qmlist-jakarta-archive-ant-dev@jakarta.apache.org Received: (qmail 21848 invoked by uid 97); 8 Jan 2002 19:59:52 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 21837 invoked by uid 97); 8 Jan 2002 19:59:51 -0000 Date: 8 Jan 2002 19:59:45 -0000 Message-ID: <20020108195945.92469.qmail@icarus.apache.org> From: sbailliez@apache.org To: jakarta-ant-cvs@apache.org Subject: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/types Substitution.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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 ScottCarlson@email.com - * @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 Arnaud Blandin - * @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 For additional commands, e-mail: