then/else parts of if statement and loop body must always been enclosed in a block statement. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270629 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -495,7 +495,9 @@ public class SQLExec extends Task { | |||
| throw new SQLException("No suitable Driver for "+url); | |||
| } | |||
| if (!isValidRdbms(conn)) return; | |||
| if (!isValidRdbms(conn)) { | |||
| return; | |||
| } | |||
| conn.setAutoCommit(autocommit); | |||
| @@ -566,8 +568,12 @@ public class SQLExec extends Task { | |||
| 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 @@ public class SQLExec extends Task { | |||
| // 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 @@ public class SQLExec extends Task { | |||
| * 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 @@ public class SQLExec extends Task { | |||
| */ | |||
| 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 @@ public class SQLExec extends Task { | |||
| } | |||
| 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); | |||
| } | |||
| } | |||
| @@ -199,7 +199,9 @@ public class SignJar extends Task { | |||
| 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 @@ public class SignJar extends Task { | |||
| 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); | |||
| @@ -333,8 +333,9 @@ public class Tar extends MatchingTask { | |||
| tOut.closeEntry(); | |||
| } finally { | |||
| if (fIn != null) | |||
| if (fIn != null) { | |||
| fIn.close(); | |||
| } | |||
| } | |||
| } | |||
| @@ -155,7 +155,9 @@ public class UpToDate extends MatchingTask implements Condition { | |||
| } | |||
| // 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; | |||
| @@ -92,8 +92,9 @@ public class War extends Jar { | |||
| */ | |||
| public void setWebxml(File descr) { | |||
| deploymentDescriptor = descr; | |||
| if (!deploymentDescriptor.exists()) | |||
| if (!deploymentDescriptor.exists()) { | |||
| throw new BuildException("Deployment descriptor: " + deploymentDescriptor + " does not exist."); | |||
| } | |||
| // Create a ZipFileSet for this file, and pass it up. | |||
| ZipFileSet fs = new ZipFileSet(); | |||
| @@ -194,8 +194,9 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
| dirs = scanner.getIncludedDirectories(); | |||
| for (int j = 0;j < dirs.length;++j){ | |||
| list=new File(baseDir,dirs[j]).list(); | |||
| for (int i = 0;i < list.length;++i) | |||
| for (int i = 0;i < list.length;++i) { | |||
| process( baseDir, list[i], destDir, stylesheet ); | |||
| } | |||
| } | |||
| } //-- execute | |||
| @@ -386,7 +387,9 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
| } | |||
| }catch (Exception ex) { | |||
| log("Failed to process " + inFile, Project.MSG_INFO); | |||
| if(outFile!=null)outFile.delete(); | |||
| if(outFile!=null) { | |||
| outFile.delete(); | |||
| } | |||
| throw new BuildException(ex); | |||
| } | |||
| } | |||
| @@ -456,12 +459,16 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
| } | |||
| public String getName() throws BuildException{ | |||
| if(name==null)throw new BuildException("Name attribute is missing."); | |||
| if(name==null) { | |||
| throw new BuildException("Name attribute is missing."); | |||
| } | |||
| return name; | |||
| } | |||
| public String getExpression() throws BuildException{ | |||
| if(expression==null)throw new BuildException("Expression attribute is missing."); | |||
| if(expression==null) { | |||
| throw new BuildException("Expression attribute is missing."); | |||
| } | |||
| return expression; | |||
| } | |||
| } | |||
| @@ -346,8 +346,9 @@ public class Zip extends MatchingTask { | |||
| // before we added any files, then we must swallow this exception. Otherwise, | |||
| // the error that's reported will be the close() error, which is not the real | |||
| // cause of the problem. | |||
| if (success) | |||
| if (success) { | |||
| throw ex; | |||
| } | |||
| } | |||
| } | |||
| } catch (IOException ioe) { | |||
| @@ -395,15 +396,17 @@ public class Zip extends MatchingTask { | |||
| */ | |||
| protected void addFiles(FileScanner scanner, ZipOutputStream zOut, | |||
| String prefix, String fullpath) throws IOException { | |||
| if (prefix.length() > 0 && fullpath.length() > 0) | |||
| if (prefix.length() > 0 && fullpath.length() > 0) { | |||
| throw new BuildException("Both prefix and fullpath attributes may not be set on the same fileset."); | |||
| } | |||
| File thisBaseDir = scanner.getBasedir(); | |||
| // directories that matched include patterns | |||
| String[] dirs = scanner.getIncludedDirectories(); | |||
| if (dirs.length > 0 && fullpath.length() > 0) | |||
| if (dirs.length > 0 && fullpath.length() > 0) { | |||
| throw new BuildException("fullpath attribute may only be specified for filesets that specify a single file."); | |||
| } | |||
| for (int i = 0; i < dirs.length; i++) { | |||
| if ("".equals(dirs[i])) { | |||
| continue; | |||
| @@ -417,8 +420,9 @@ public class Zip extends MatchingTask { | |||
| // files that matched include patterns | |||
| String[] files = scanner.getIncludedFiles(); | |||
| if (files.length > 1 && fullpath.length() > 0) | |||
| if (files.length > 1 && fullpath.length() > 0) { | |||
| throw new BuildException("fullpath attribute may only be specified for filesets that specify a single file."); | |||
| } | |||
| for (int i = 0; i < files.length; i++) { | |||
| File f = new File(thisBaseDir, files[i]); | |||
| if (fullpath.length() > 0) | |||
| @@ -441,8 +445,9 @@ public class Zip extends MatchingTask { | |||
| ZipOutputStream zOut, String prefix, String fullpath) | |||
| throws IOException | |||
| { | |||
| if (prefix.length() > 0 && fullpath.length() > 0) | |||
| if (prefix.length() > 0 && fullpath.length() > 0) { | |||
| throw new BuildException("Both prefix and fullpath attributes may not be set on the same fileset."); | |||
| } | |||
| ZipScanner zipScanner = (ZipScanner) ds; | |||
| File zipSrc = fs.getSrc(); | |||
| @@ -547,7 +552,9 @@ public class Zip extends MatchingTask { | |||
| } | |||
| } | |||
| if (!zipFile.exists()) return false; | |||
| if (!zipFile.exists()) { | |||
| return false; | |||
| } | |||
| SourceFileScanner sfs = new SourceFileScanner(this); | |||
| MergingMapper mm = new MergingMapper(); | |||
| @@ -571,8 +578,9 @@ public class Zip extends MatchingTask { | |||
| Vector files = new Vector(); | |||
| for (int i = 0; i < fileNames.length; i++) { | |||
| File thisBaseDir = scanners[i].getBasedir(); | |||
| for (int j = 0; j < fileNames[i].length; j++) | |||
| for (int j = 0; j < fileNames[i].length; j++) { | |||
| files.addElement(new File(thisBaseDir, fileNames[i][j])); | |||
| } | |||
| } | |||
| File[] toret = new File[files.size()]; | |||
| files.copyInto(toret); | |||
| @@ -95,8 +95,9 @@ public class AdaptxLiaison implements XSLTLiaison { | |||
| } | |||
| public void setOutputtype(String type) throws Exception { | |||
| if (!type.equals("xml")) | |||
| if (!type.equals("xml")) { | |||
| throw new BuildException("Unsupported output type: " + type); | |||
| } | |||
| } | |||
| } //-- AdaptxLiaison | |||
| @@ -173,7 +173,9 @@ public class Rpm extends Task { | |||
| 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()); | |||
| @@ -83,10 +83,13 @@ public class Script extends Task { | |||
| 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 class Script extends Task { | |||
| */ | |||
| 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]; | |||
| @@ -196,7 +196,9 @@ public class TraXLiaison implements XSLTLiaison, ErrorListener, XSLTLoggerAware | |||
| 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"); | |||
| @@ -256,10 +256,11 @@ public class XMLValidateTask extends Task { | |||
| } | |||
| else { | |||
| String errorMsg = "File " + file + " cannot be read"; | |||
| if (failOnError) | |||
| if (failOnError) { | |||
| throw new BuildException(errorMsg); | |||
| else | |||
| } else { | |||
| log(errorMsg, Project.MSG_ERR); | |||
| } | |||
| } | |||
| } | |||
| @@ -295,8 +296,9 @@ public class XMLValidateTask extends Task { | |||
| // loader.addSystemPackageRoot("org.xml"); // needed to avoid conflict | |||
| readerClass = loader.loadClass(readerClassName); | |||
| AntClassLoader.initializeClass(readerClass); | |||
| } else | |||
| } else { | |||
| readerClass = Class.forName(readerClassName); | |||
| } | |||
| // then check it implements XMLReader | |||
| if (XMLReader.class.isAssignableFrom(readerClass)) { | |||
| @@ -357,17 +359,19 @@ public class XMLValidateTask extends Task { | |||
| xmlReader.setFeature(feature,value); | |||
| toReturn = true; | |||
| } catch (SAXNotRecognizedException e) { | |||
| if (warn) | |||
| if (warn) { | |||
| log("Could not set feature '" | |||
| + feature | |||
| + "' because the parser doesn't recognize it", | |||
| Project.MSG_WARN); | |||
| } | |||
| } catch (SAXNotSupportedException e) { | |||
| if (warn) | |||
| if (warn) { | |||
| log("Could not set feature '" | |||
| + feature | |||
| + "' because the parser doesn't support it", | |||
| Project.MSG_WARN); | |||
| } | |||
| } | |||
| return toReturn; | |||
| } | |||
| @@ -387,17 +391,19 @@ public class XMLValidateTask extends Task { | |||
| is.setSystemId(uri); | |||
| xmlReader.parse(is); | |||
| } catch (SAXException ex) { | |||
| if (failOnError) | |||
| if (failOnError) { | |||
| throw new BuildException("Could not validate document " + afile); | |||
| } | |||
| } catch (IOException ex) { | |||
| throw new BuildException("Could not validate document " + afile, ex); | |||
| } | |||
| if (errorHandler.getFailure()) { | |||
| if (failOnError) | |||
| if (failOnError) { | |||
| throw new BuildException(afile + " is not a valid XML document."); | |||
| else | |||
| } else { | |||
| log(afile + " is not a valid XML document",Project.MSG_ERR); | |||
| } | |||
| } | |||
| } | |||
| @@ -438,8 +444,9 @@ public class XMLValidateTask extends Task { | |||
| public void warning(SAXParseException exception) { | |||
| // depending on implementation, XMLReader can yield hips of warning, | |||
| // only output then if user explicitely asked for it | |||
| if (warn) | |||
| if (warn) { | |||
| doLog(exception,Project.MSG_WARN); | |||
| } | |||
| } | |||
| private void doLog(SAXParseException e, int logLevel) { | |||
| @@ -130,7 +130,8 @@ public class XalanLiaison implements XSLTLiaison { | |||
| } | |||
| public void setOutputtype(String type) throws Exception { | |||
| if (!type.equals("xml")) | |||
| if (!type.equals("xml")) { | |||
| throw new BuildException("Unsupported output type: " + type); | |||
| } | |||
| } | |||
| } //-- XalanLiaison | |||
| @@ -105,8 +105,9 @@ public class XslpLiaison implements XSLTLiaison { | |||
| } | |||
| public void setOutputtype(String type) throws Exception { | |||
| if (!type.equals("xml")) | |||
| if (!type.equals("xml")) { | |||
| throw new BuildException("Unsupported output type: " + type); | |||
| } | |||
| } | |||
| } //-- XSLPLiaison | |||
| @@ -1036,9 +1036,10 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { | |||
| if (getCombinedClasspath() != null && getCombinedClasspath().toString().length() > 0) | |||
| if (getCombinedClasspath() != null && getCombinedClasspath().toString().length() > 0) { | |||
| args += " -cp " + getCombinedClasspath(); | |||
| } | |||
| @@ -258,8 +258,9 @@ public class VAJAntToolGUI extends Frame { | |||
| public void messageLogged(BuildEvent event) { | |||
| if (event.getPriority() <= getBuildInfo().getOutputMessageLevel()) { | |||
| String msg = ""; | |||
| if (event.getTask() != null) | |||
| if (event.getTask() != null) { | |||
| msg = "[" + event.getTask().getTaskName() + "] "; | |||
| } | |||
| getMessageTextArea().append(lineSeparator + msg + event.getMessage()); | |||
| } | |||
| } | |||
| @@ -345,22 +346,29 @@ public class VAJAntToolGUI extends Frame { | |||
| } | |||
| } | |||
| // MenuItems | |||
| if (e.getSource() == VAJAntToolGUI.this.getSaveMenuItem()) | |||
| if (e.getSource() == VAJAntToolGUI.this.getSaveMenuItem()) { | |||
| saveBuildInfo(); | |||
| if (e.getSource() == VAJAntToolGUI.this.getAboutMenuItem()) | |||
| } | |||
| if (e.getSource() == VAJAntToolGUI.this.getAboutMenuItem()) { | |||
| getAboutDialog().show(); | |||
| if (e.getSource() == VAJAntToolGUI.this.getShowLogMenuItem()) | |||
| } | |||
| if (e.getSource() == VAJAntToolGUI.this.getShowLogMenuItem()) { | |||
| getMessageFrame().show(); | |||
| } | |||
| /* #### About dialog #### */ | |||
| if (e.getSource() == VAJAntToolGUI.this.getAboutOkButton()) | |||
| if (e.getSource() == VAJAntToolGUI.this.getAboutOkButton()) { | |||
| getAboutDialog().dispose(); | |||
| } | |||
| /* #### Log frame #### */ | |||
| if (e.getSource() == VAJAntToolGUI.this.getMessageOkButton()) | |||
| if (e.getSource() == VAJAntToolGUI.this.getMessageOkButton()) { | |||
| getMessageFrame().dispose(); | |||
| if (e.getSource() == VAJAntToolGUI.this.getMessageClearLogButton()) | |||
| } | |||
| if (e.getSource() == VAJAntToolGUI.this.getMessageClearLogButton()) { | |||
| getMessageTextArea().setText(""); | |||
| if (e.getSource() == VAJAntToolGUI.this.getMessageOkButton()) | |||
| } | |||
| if (e.getSource() == VAJAntToolGUI.this.getMessageOkButton()) { | |||
| getMessageFrame().dispose(); | |||
| } | |||
| } | |||
| catch (Throwable exc) { | |||
| handleException(exc); | |||
| @@ -372,12 +380,15 @@ public class VAJAntToolGUI extends Frame { | |||
| */ | |||
| public void itemStateChanged(ItemEvent e) { | |||
| try { | |||
| if (e.getSource() == VAJAntToolGUI.this.getTargetList()) | |||
| if (e.getSource() == VAJAntToolGUI.this.getTargetList()) { | |||
| getBuildButton().setEnabled(true); | |||
| if (e.getSource() == VAJAntToolGUI.this.getMessageOutputLevelChoice()) | |||
| } | |||
| if (e.getSource() == VAJAntToolGUI.this.getMessageOutputLevelChoice()) { | |||
| getBuildInfo().setOutputMessageLevel(getMessageOutputLevelChoice().getSelectedIndex()); | |||
| if (e.getSource() == VAJAntToolGUI.this.getTargetList()) | |||
| } | |||
| if (e.getSource() == VAJAntToolGUI.this.getTargetList()) { | |||
| getBuildInfo().setTarget(getTargetList().getSelectedItem()); | |||
| } | |||
| } | |||
| catch (Throwable exc) { | |||
| handleException(exc); | |||
| @@ -388,18 +399,21 @@ public class VAJAntToolGUI extends Frame { | |||
| * PropertyChangeListener method | |||
| */ | |||
| public void propertyChange(java.beans.PropertyChangeEvent evt) { | |||
| if (evt.getSource() == VAJAntToolGUI.this.getBuildInfo() && (evt.getPropertyName().equals("projectName"))) | |||
| if (evt.getSource() == VAJAntToolGUI.this.getBuildInfo() && (evt.getPropertyName().equals("projectName"))) { | |||
| connectProjectNameToLabel(); | |||
| if (evt.getSource() == VAJAntToolGUI.this.getBuildInfo() && (evt.getPropertyName().equals("buildFileName"))) | |||
| } | |||
| if (evt.getSource() == VAJAntToolGUI.this.getBuildInfo() && (evt.getPropertyName().equals("buildFileName"))) { | |||
| connectBuildFileNameToTextField(); | |||
| } | |||
| } | |||
| /** | |||
| * TextListener method | |||
| */ | |||
| public void textValueChanged(TextEvent e) { | |||
| if (e.getSource() == VAJAntToolGUI.this.getBuildFileTextField()) | |||
| if (e.getSource() == VAJAntToolGUI.this.getBuildFileTextField()) { | |||
| connectTextFieldToBuildFileName(); | |||
| } | |||
| } | |||
| /** | |||
| @@ -411,10 +425,12 @@ public class VAJAntToolGUI extends Frame { | |||
| dispose(); | |||
| System.exit(0); | |||
| } | |||
| if (e.getSource() == VAJAntToolGUI.this.getAboutDialog()) | |||
| if (e.getSource() == VAJAntToolGUI.this.getAboutDialog()) { | |||
| getAboutDialog().dispose(); | |||
| if (e.getSource() == VAJAntToolGUI.this.getMessageFrame()) | |||
| } | |||
| if (e.getSource() == VAJAntToolGUI.this.getMessageFrame()) { | |||
| getMessageFrame().dispose(); | |||
| } | |||
| } | |||
| catch (Throwable exc) { | |||
| handleException(exc); | |||
| @@ -123,15 +123,18 @@ public class TelnetTask extends Task { | |||
| 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 @@ public class TelnetTask extends Task { | |||
| 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 @@ public class TelnetTask extends Task { | |||
| */ | |||
| 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 class TelnetTask extends Task { | |||
| */ | |||
| public void setDefaultTimeout(Integer defaultTimeout) | |||
| { | |||
| if (timeout == null) | |||
| if (timeout == null) { | |||
| timeout = defaultTimeout; | |||
| } | |||
| } | |||
| } | |||
| /** | |||
| @@ -336,8 +343,9 @@ public class TelnetTask extends Task { | |||
| 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 @@ public class TelnetTask extends Task { | |||
| OutputStream os =this.getOutputStream(); | |||
| try { | |||
| os.write((s + "\n").getBytes()); | |||
| if (echoString) | |||
| if (echoString) { | |||
| log(s, Project.MSG_INFO); | |||
| } | |||
| os.flush(); | |||
| } catch (Exception e) | |||
| { | |||
| @@ -69,7 +69,9 @@ public class SimpleP4OutputHandler extends P4HandlerAdapter { | |||
| } | |||
| 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 | |||
| @@ -434,8 +434,9 @@ public abstract class TreeBasedTask extends StarTeamTask { | |||
| 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 | |||
| @@ -93,8 +93,9 @@ public class Substitution extends DataType | |||
| */ | |||
| public String getExpression(Project p) | |||
| { | |||
| if (isReference()) | |||
| if (isReference()) { | |||
| return getRef(p).getExpression(p); | |||
| } | |||
| return expression; | |||
| } | |||