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