git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@574889 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -338,7 +338,7 @@ public abstract class AbstractCvsTask extends Task { | |||
| log(actualCommandLine, Project.MSG_VERBOSE); | |||
| int retCode = exe.execute(); | |||
| log("retCode=" + retCode, Project.MSG_DEBUG); | |||
| if (failOnError && Execute.isFailure(retCode)) { | |||
| throw new BuildException("cvs exited with error code " | |||
| + retCode | |||
| @@ -430,7 +430,7 @@ public abstract class AbstractCvsTask extends Task { | |||
| } | |||
| /** | |||
| * Removes the cvs password from the command line, if given on the command | |||
| * Removes the cvs password from the command line, if given on the command | |||
| * line. This password can be given on the command line in the cvsRoot | |||
| * -d:pserver:user:password@server:path | |||
| * It has to be noted that the password may be omitted altogether. | |||
| @@ -450,16 +450,16 @@ public abstract class AbstractCvsTask extends Task { | |||
| stop = cmdLine.indexOf("@", start); | |||
| if (stop >= 0 && startpass > startproto && startpass < stop) { | |||
| for (int i = startpass + 1; i < stop; i++) { | |||
| stringBuffer.replace(i, i+1, "*"); | |||
| stringBuffer.replace(i, i + 1, "*"); | |||
| } | |||
| } | |||
| } | |||
| return stringBuffer; | |||
| } | |||
| /** | |||
| * The CVSROOT variable. | |||
| * | |||
| * | |||
| * @param root | |||
| * the CVSROOT variable | |||
| */ | |||
| @@ -65,7 +65,7 @@ public class TempFile extends Task { | |||
| /** deleteOnExit flag */ | |||
| private boolean deleteOnExit; | |||
| /** createFile flag */ | |||
| private boolean createFile; | |||
| @@ -126,7 +126,7 @@ public class TempFile extends Task { | |||
| public boolean isDeleteOnExit() { | |||
| return deleteOnExit; | |||
| } | |||
| /** | |||
| * If set the file is actually created, if not just a name is created. | |||
| * @param createFile boolean flag. | |||
| @@ -59,7 +59,7 @@ public class Equals implements Condition { | |||
| this.arg1 = arg1; | |||
| args |= 1; | |||
| } | |||
| /** | |||
| * Set the second argument | |||
| * @param arg2 the second argument. | |||
| @@ -86,7 +86,7 @@ public class Equals implements Condition { | |||
| this.arg2 = arg2; | |||
| args |= 2; | |||
| } | |||
| /** | |||
| * Should we want to trim the arguments before comparing them? | |||
| * @param b if true trim the arguments | |||
| @@ -129,6 +129,8 @@ public class FailureRecorder implements JUnitResultFormatter { | |||
| /** | |||
| * Add the failed test to the list. | |||
| * @param test the test that errored. | |||
| * @param throwable the reason it errored. | |||
| * @see junit.framework.TestListener#addError(junit.framework.Test, java.lang.Throwable) | |||
| */ | |||
| public void addError(Test test, Throwable throwable) { | |||
| @@ -138,6 +140,8 @@ public class FailureRecorder implements JUnitResultFormatter { | |||
| // CheckStyle:LineLengthCheck OFF - @see is long | |||
| /** | |||
| * Add the failed test to the list. | |||
| * @param test the test that failed. | |||
| * @param error the assertion that failed. | |||
| * @see junit.framework.TestListener#addFailure(junit.framework.Test, junit.framework.AssertionFailedError) | |||
| */ | |||
| // CheckStyle:LineLengthCheck ON | |||
| @@ -215,7 +219,7 @@ public class FailureRecorder implements JUnitResultFormatter { | |||
| writer.println(" super(testname);"); | |||
| writer.println(" }"); | |||
| } | |||
| private void createSuiteMethod() { | |||
| writer.println(" public static Test suite() {"); | |||
| writer.println(" TestSuite suite = new TestSuite();"); | |||
| @@ -228,24 +232,24 @@ public class FailureRecorder implements JUnitResultFormatter { | |||
| writer.println(" return suite;"); | |||
| writer.println(" }"); | |||
| } | |||
| private void createClassFooter() { | |||
| writer.println("}"); | |||
| } | |||
| // Helper classes | |||
| /** | |||
| * TestInfos holds information about a given test for later use. | |||
| */ | |||
| public class TestInfos implements Comparable { | |||
| /** The class name of the test. */ | |||
| String className; | |||
| private String className; | |||
| /** The method name of the testcase. */ | |||
| String methodName; | |||
| private String methodName; | |||
| /** | |||
| * This constructor extracts the needed information from the given test. | |||
| * @param test Test to analyze | |||
| @@ -255,21 +259,24 @@ public class FailureRecorder implements JUnitResultFormatter { | |||
| methodName = test.toString(); | |||
| methodName = methodName.substring(0, methodName.indexOf('(')); | |||
| } | |||
| /** | |||
| * This String-Representation can directly be used for instantiation of | |||
| * the JUnit testcase. | |||
| * @return the string representation. | |||
| * @see java.lang.Object#toString() | |||
| * @see FailureRecorder#createSuiteMethod() | |||
| */ | |||
| public String toString() { | |||
| return "new " + className + "(\"" + methodName + "\")"; | |||
| } | |||
| /* | |||
| /** | |||
| * The SortedMap needs comparable elements. | |||
| * @param other the object to compare to. | |||
| * @return the result of the comparison. | |||
| * @see java.lang.Comparable#compareTo(T) | |||
| * @see SortedSet#comparator() | |||
| * @see SortedSet#comparator() | |||
| */ | |||
| public int compareTo(Object other) { | |||
| if (other instanceof TestInfos) { | |||
| @@ -371,7 +371,7 @@ public class FTP | |||
| } | |||
| for (int i = 0; i < newfiles.length; i++) { | |||
| FTPFile file = newfiles[i]; | |||
| if (file != null | |||
| if (file != null | |||
| && !file.getName().equals(".") | |||
| && !file.getName().equals("..")) { | |||
| if (isFunctioningAsDirectory(ftp, dir, file)) { | |||
| @@ -581,7 +581,9 @@ public class FTP | |||
| + target + " where a directory called " + array[icounter].getName() | |||
| + " exists", Project.MSG_DEBUG); | |||
| for (int pcounter = 0; pcounter < array.length; pcounter++) { | |||
| if (array[pcounter] != null && pcounter != icounter && target.equals(array[pcounter].getName()) ) { | |||
| if (array[pcounter] != null | |||
| && pcounter != icounter | |||
| && target.equals(array[pcounter].getName())) { | |||
| candidateFound = false; | |||
| } | |||
| } | |||
| @@ -720,7 +722,8 @@ public class FTP | |||
| return null; | |||
| } | |||
| for (int icounter = 0; icounter < theFiles.length; icounter++) { | |||
| if (theFiles[icounter] != null && theFiles[icounter].getName().equalsIgnoreCase(soughtPathElement)) { | |||
| if (theFiles[icounter] != null | |||
| && theFiles[icounter].getName().equalsIgnoreCase(soughtPathElement)) { | |||
| return theFiles[icounter].getName(); | |||
| } | |||
| } | |||
| @@ -1824,7 +1827,8 @@ public class FTP | |||
| FTPFile [] theFiles = null; | |||
| final int maxIterations = 1000; | |||
| for (int counter = 1; counter < maxIterations; counter++) { | |||
| File localFile = FILE_UTILS.createTempFileName("ant" + Integer.toString(counter), ".tmp", | |||
| File localFile = FILE_UTILS.createTempFileName( | |||
| "ant" + Integer.toString(counter), ".tmp", | |||
| null, false); | |||
| String fileName = localFile.getName(); | |||
| boolean found = false; | |||
| @@ -1833,7 +1837,8 @@ public class FTP | |||
| theFiles = ftp.listFiles(); | |||
| } | |||
| for (int counter2 = 0; counter2 < theFiles.length; counter2++) { | |||
| if (theFiles[counter2] != null && theFiles[counter2].getName().equals(fileName)) { | |||
| if (theFiles[counter2] != null | |||
| && theFiles[counter2].getName().equals(fileName)) { | |||
| found = true; | |||
| break; | |||
| } | |||
| @@ -826,19 +826,17 @@ public class FileUtils { | |||
| String parent = (parentDir == null) | |||
| ? System.getProperty("java.io.tmpdir") | |||
| : parentDir.getPath(); | |||
| try { | |||
| result = File.createTempFile(prefix, suffix, new File(parent)); | |||
| } catch (IOException e) { | |||
| throw new BuildException("Could not create tempfile in " + parent, e); | |||
| } | |||
| if (deleteOnExit) { | |||
| result.deleteOnExit(); | |||
| } | |||
| return result; | |||
| } | |||
| /** | |||
| * Create a File object for a temporary file in a given directory. Without | |||
| * actually creating the file. | |||
| @@ -878,8 +876,6 @@ public class FileUtils { | |||
| } | |||
| return result; | |||
| } | |||
| /** | |||
| * Compares the contents of two files. | |||