You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by jg...@apache.org on 2010/05/03 19:44:28 UTC
svn commit: r940531 [5/7] - in /ant/core/branches/run-single-test-method: ./
docs/ docs/antlibs/ docs/manual/ docs/manual/CoreTasks/
docs/manual/CoreTypes/ docs/manual/OptionalTasks/ docs/webtest/gettest/
lib/ src/etc/ src/etc/poms/ src/etc/poms/ant-an...
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java Mon May 3 17:44:21 2010
@@ -73,6 +73,7 @@ import org.apache.tools.ant.util.FileUti
* <li>suppressVariableNotUsed</li>
* <li>suppressExceptionNotSignalled</li>
* <li>suppressDeprecation</li>
+ * <li>removeKeepExtension</li>
* </ul>
* Of these arguments, the <b>srcdir</b> argument is required.
*
@@ -126,6 +127,7 @@ public class NetRexxC extends MatchingTa
private boolean suppressVariableNotUsed = false;
private boolean suppressExceptionNotSignalled = false;
private boolean suppressDeprecation = false;
+ private boolean removeKeepExtension = false;
// constants for the messages to suppress by flags and their corresponding properties
static final String MSG_METHOD_ARGUMENT_NOT_USED
@@ -144,6 +146,8 @@ public class NetRexxC extends MatchingTa
/**
* Set whether literals are treated as binary, rather than NetRexx types.
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+ * The default is false.
* @param binary a <code>boolean</code> value.
*/
public void setBinary(boolean binary) {
@@ -162,8 +166,8 @@ public class NetRexxC extends MatchingTa
/**
* Set whether comments are passed through to the generated java source.
- * Valid true values are "on" or "true". Anything else sets the flag to
- * false. The default value is false
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+ * The default value is false.
* @param comments a <code>boolean</code> value.
*/
public void setComments(boolean comments) {
@@ -172,9 +176,9 @@ public class NetRexxC extends MatchingTa
/**
- * Set whether error messages come out in compact or verbose format. Valid
- * true values are "on" or "true". Anything else sets the flag to false.
- * The default value is false
+ * Set whether error messages come out in compact or verbose format.
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+ * The default value is true.
* @param compact a <code>boolean</code> value.
*/
public void setCompact(boolean compact) {
@@ -183,10 +187,10 @@ public class NetRexxC extends MatchingTa
/**
- * Set whether the NetRexx compiler should compile the generated java code
- * Valid true values are "on" or "true". Anything else sets the flag to
- * false. The default value is true. Setting this flag to false, will
- * automatically set the keep flag to true.
+ * Set whether the NetRexx compiler should compile the generated java code.
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+ * The default value is true.
+ * Setting this flag to false, will automatically set the keep flag to true.
* @param compile a <code>boolean</code> value.
*/
public void setCompile(boolean compile) {
@@ -198,9 +202,10 @@ public class NetRexxC extends MatchingTa
/**
- * Set whether or not messages should be displayed on the 'console' Valid
- * true values are "on" or "true". Anything else sets the flag to false.
- * The default value is true.
+ * Set whether or not compiler messages should be displayed on the 'console'.
+ * Note that this task will rely on the default value for filtering compile messages.
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+ * The default value is false.
* @param console a <code>boolean</code> value.
*/
public void setConsole(boolean console) {
@@ -210,6 +215,8 @@ public class NetRexxC extends MatchingTa
/**
* Whether variable cross references are generated.
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+ * The default value is false.
* @param crossref a <code>boolean</code> value.
*/
public void setCrossref(boolean crossref) {
@@ -219,9 +226,10 @@ public class NetRexxC extends MatchingTa
/**
* Set whether decimal arithmetic should be used for the netrexx code.
- * Binary arithmetic is used when this flag is turned off. Valid true
- * values are "on" or "true". Anything else sets the flag to false. The
- * default value is true.
+ * Setting this to off will report decimal arithmetic as an error, for
+ * performance critical applications.
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+ * The default value is true.
* @param decimal a <code>boolean</code> value.
*/
public void setDecimal(boolean decimal) {
@@ -249,8 +257,8 @@ public class NetRexxC extends MatchingTa
/**
- * Sets whether variables must be declared explicitly before use. Valid
- * true values are "on" or "true". Anything else sets the flag to false.
+ * Sets whether variables must be declared explicitly before use.
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
* The default value is false.
* @param explicit a <code>boolean</code> value.
*/
@@ -262,6 +270,8 @@ public class NetRexxC extends MatchingTa
/**
* Whether the generated java code is formatted nicely or left to match
* NetRexx line numbers for call stack debugging.
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+ * The default value false.
* @param format a <code>boolean</code> value.
*/
public void setFormat(boolean format) {
@@ -270,9 +280,8 @@ public class NetRexxC extends MatchingTa
/**
- * Whether the generated java code is produced Valid true values are "on"
- * or "true". Anything else sets the flag to false. The default value is
- * false.
+ * Whether the generated java code is produced.
+ * This is not implemented yet.
* @param java a <code>boolean</code> value.
*/
public void setJava(boolean java) {
@@ -283,9 +292,11 @@ public class NetRexxC extends MatchingTa
/**
* Sets whether the generated java source file should be kept after
* compilation. The generated files will have an extension of .java.keep,
- * <b>not</b> .java Valid true values are "on" or "true". Anything else
- * sets the flag to false. The default value is false.
+ * <b>not</b> .java. See setRemoveKeepExtension
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+ * The default value is false.
* @param keep a <code>boolean</code> value.
+ * @see #setRemoveKeepExtension(boolean)
*/
public void setKeep(boolean keep) {
this.keep = keep;
@@ -294,6 +305,8 @@ public class NetRexxC extends MatchingTa
/**
* Whether the compiler text logo is displayed when compiling.
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+ * The default value is false.
* @param logo a <code>boolean</code> value.
*/
public void setLogo(boolean logo) {
@@ -302,9 +315,9 @@ public class NetRexxC extends MatchingTa
/**
- * Whether the generated .java file should be replaced when compiling
- * Valid true values are "on" or "true". Anything else sets the flag to
- * false. The default value is false.
+ * Whether the generated .java file should be replaced when compiling.
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+ * The default value is false.
* @param replace a <code>boolean</code> value.
*/
public void setReplace(boolean replace) {
@@ -314,8 +327,9 @@ public class NetRexxC extends MatchingTa
/**
* Sets whether the compiler messages will be written to NetRexxC.log as
- * well as to the console Valid true values are "on" or "true". Anything
- * else sets the flag to false. The default value is false.
+ * well as to the console.
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+ * The default value is false.
* @param savelog a <code>boolean</code> value.
*/
public void setSavelog(boolean savelog) {
@@ -325,9 +339,9 @@ public class NetRexxC extends MatchingTa
/**
* Tells the NetRexx compiler to store the class files in the same
- * directory as the source files. The alternative is the working directory
- * Valid true values are "on" or "true". Anything else sets the flag to
- * false. The default value is true.
+ * directory as the source files. The alternative is the working directory.
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+ * The default value is true.
* @param sourcedir a <code>boolean</code> value.
*/
public void setSourcedir(boolean sourcedir) {
@@ -347,9 +361,9 @@ public class NetRexxC extends MatchingTa
/**
* Tells the NetRexx compiler that method calls always need parentheses,
* even if no arguments are needed, e.g. <code>aStringVar.getBytes</code>
- * vs. <code>aStringVar.getBytes()</code> Valid true values are "on" or
- * "true". Anything else sets the flag to false. The default value is
- * false.
+ * vs. <code>aStringVar.getBytes()</code>.
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+ * The default value is false.
* @param strictargs a <code>boolean</code> value.
*/
public void setStrictargs(boolean strictargs) {
@@ -359,6 +373,8 @@ public class NetRexxC extends MatchingTa
/**
* Tells the NetRexx compile that assignments must match exactly on type.
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+ * The default value is false.
* @param strictassign a <code>boolean</code> value.
*/
public void setStrictassign(boolean strictassign) {
@@ -368,6 +384,8 @@ public class NetRexxC extends MatchingTa
/**
* Specifies whether the NetRexx compiler should be case sensitive or not.
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+ * The default value is false.
* @param strictcase a <code>boolean</code> value.
*/
public void setStrictcase(boolean strictcase) {
@@ -378,8 +396,9 @@ public class NetRexxC extends MatchingTa
/**
* Sets whether classes need to be imported explicitly using an <code>import</code>
* statement. By default the NetRexx compiler will import certain packages
- * automatically Valid true values are "on" or "true". Anything else sets
- * the flag to false. The default value is false.
+ * automatically.
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+ * The default value is false.
* @param strictimport a <code>boolean</code> value.
*/
public void setStrictimport(boolean strictimport) {
@@ -389,8 +408,9 @@ public class NetRexxC extends MatchingTa
/**
* Sets whether local properties need to be qualified explicitly using
- * <code>this</code> Valid true values are "on" or "true". Anything else
- * sets the flag to false. The default value is false.
+ * <code>this</code>.
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+ * The default value is false.
* @param strictprops a <code>boolean</code> value.
*/
public void setStrictprops(boolean strictprops) {
@@ -401,6 +421,8 @@ public class NetRexxC extends MatchingTa
/**
* Whether the compiler should force catching of exceptions by explicitly
* named types.
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+ * The default value is false
* @param strictsignal a <code>boolean</code> value.
*/
public void setStrictsignal(boolean strictsignal) {
@@ -409,9 +431,9 @@ public class NetRexxC extends MatchingTa
/**
- * Sets whether debug symbols should be generated into the class file
- * Valid true values are "on" or "true". Anything else sets the flag to
- * false. The default value is false.
+ * Sets whether debug symbols should be generated into the class file.
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+ * The default value is false.
* @param symbols a <code>boolean</code> value.
*/
public void setSymbols(boolean symbols) {
@@ -421,8 +443,8 @@ public class NetRexxC extends MatchingTa
/**
* Asks the NetRexx compiler to print compilation times to the console
- * Valid true values are "on" or "true". Anything else sets the flag to
- * false. The default value is false.
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+ * The default value is false.
* @param time a <code>boolean</code> value.
*/
public void setTime(boolean time) {
@@ -454,9 +476,9 @@ public class NetRexxC extends MatchingTa
/**
- * Tells the NetRexx compiler that the source is in UTF8 Valid true values
- * are "on" or "true". Anything else sets the flag to false. The default
- * value is false.
+ * Tells the NetRexx compiler that the source is in UTF8.
+ * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+ * The default value is false.
* @param utf8 a <code>boolean</code> value.
*/
public void setUtf8(boolean utf8) {
@@ -539,6 +561,16 @@ public class NetRexxC extends MatchingTa
/**
+ * Tells wether the trailing .keep in nocompile-mode should be removed
+ * so that the resulting java source really ends on .java.
+ * This facilitates the use of the javadoc tool lateron.
+ */
+ public void setRemoveKeepExtension(boolean removeKeepExtension) {
+ this.removeKeepExtension = removeKeepExtension;
+ }
+
+
+ /**
* init-Method sets defaults from Properties. That way, when ant is called
* with arguments like -Dant.netrexxc.verbose=verbose5 one can easily take
* control of all netrexxc-tasks.
@@ -642,6 +674,9 @@ public class NetRexxC extends MatchingTa
if ((p = getProject().getProperty("ant.netrexxc.suppressDeprecation")) != null) {
this.suppressDeprecation = Project.toBoolean(p);
}
+ if ((p = getProject().getProperty("ant.netrexxc.removeKeepExtension")) != null) {
+ this.removeKeepExtension = Project.toBoolean(p);
+ }
}
@@ -674,6 +709,9 @@ public class NetRexxC extends MatchingTa
+ (compileList.size() == 1 ? "" : "s")
+ " to " + destDir);
doNetRexxCompile();
+ if (removeKeepExtension && (!compile || keep)) {
+ removeKeepExtensions();
+ }
}
}
@@ -695,8 +733,18 @@ public class NetRexxC extends MatchingTa
File classFile =
new File(destDir,
filename.substring(0, filename.lastIndexOf('.')) + ".class");
+ File javaFile =
+ new File(destDir,
+ filename.substring(0, filename.lastIndexOf('.'))
+ + (removeKeepExtension ? ".java" : ".java.keep"));
- if (!compile || srcFile.lastModified() > classFile.lastModified()) {
+ // nocompile case tests against .java[.keep] file
+ if (!compile && srcFile.lastModified() > javaFile.lastModified()) {
+ filecopyList.put(srcFile.getAbsolutePath(), destFile.getAbsolutePath());
+ compileList.addElement(destFile.getAbsolutePath());
+ }
+ // compile case tests against .class file
+ else if (compile && srcFile.lastModified() > classFile.lastModified()) {
filecopyList.put(srcFile.getAbsolutePath(), destFile.getAbsolutePath());
compileList.addElement(destFile.getAbsolutePath());
}
@@ -735,6 +783,30 @@ public class NetRexxC extends MatchingTa
}
+ /**
+ * Rename .java.keep files (back) to .java. The netrexxc renames all
+ * .java files to .java.keep if either -keep or -nocompile option is set.
+ */
+ private void removeKeepExtensions() {
+ if (compileList.size() > 0) {
+ log("Removing .keep extension on " + compileList.size() + " file"
+ + (compileList.size() == 1 ? "" : "s"));
+ Enumeration e = compileList.elements();
+ while (e.hasMoreElements()) {
+ String nrxName = (String) e.nextElement();
+ String baseName = nrxName.substring(0, nrxName.lastIndexOf('.'));
+ File fromFile = new File(baseName + ".java.keep");
+ File toFile = new File(baseName + ".java");
+ if (fromFile.renameTo(toFile)) {
+ log("Successfully renamed " + fromFile + " to " + toFile, Project.MSG_VERBOSE);
+ } else {
+ log("Failed to rename " + fromFile + " to " + toFile);
+ }
+ }
+ }
+ }
+
+
/** Performs a compile using the NetRexx 1.1.x compiler */
private void doNetRexxCompile() throws BuildException {
log("Using NetRexx compiler", Project.MSG_VERBOSE);
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/image/Image.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/image/Image.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/image/Image.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/image/Image.java Mon May 3 17:44:21 2010
@@ -40,6 +40,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.Locale;
import java.util.Vector;
/**
@@ -316,7 +317,8 @@ public class Image extends MatchingTask
try {
stream = new FileOutputStream(newFile);
- JAI.create("encode", image, stream, str_encoding.toUpperCase(),
+ JAI.create("encode", image, stream,
+ str_encoding.toUpperCase(Locale.ENGLISH),
null);
stream.flush();
} finally {
@@ -406,9 +408,9 @@ public class Image extends MatchingTask
if (srcDir == null && destDir == null) {
throw new BuildException("Specify the destDir, or the srcDir.");
}
- if (str_encoding.toLowerCase().equals("jpg")) {
+ if (str_encoding.equalsIgnoreCase("jpg")) {
str_encoding = "JPEG";
- } else if (str_encoding.toLowerCase().equals("tif")) {
+ } else if (str_encoding.equalsIgnoreCase("tif")) {
str_encoding = "TIFF";
}
}
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java Mon May 3 17:44:21 2010
@@ -79,7 +79,8 @@ public class FailureRecorder extends Pro
public static final String MAGIC_PROPERTY_CLASS_LOCATION
= "ant.junit.failureCollector";
- /** Default location and name for the generated JUnit class file. {@value} */
+ /** Default location and name for the generated JUnit class file,
+ * in the temp directory + FailedTests */
public static final String DEFAULT_CLASS_LOCATION
= System.getProperty("java.io.tmpdir") + "FailedTests";
@@ -366,7 +367,7 @@ public class FailureRecorder extends Pro
* 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
* @see SortedSet#comparator()
*/
public int compareTo(Object other) {
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java Mon May 3 17:44:21 2010
@@ -39,7 +39,6 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Vector;
-import java.util.Locale;
import org.apache.tools.ant.AntClassLoader;
import org.apache.tools.ant.BuildException;
@@ -793,6 +792,8 @@ public class JUnitTask extends Task {
* @throws BuildException in case of test failures or errors
*/
protected void execute(JUnitTest arg) throws BuildException {
+ validateTestName(arg.getName());
+
JUnitTest test = (JUnitTest) arg.clone();
// set the default values if not specified
//@todo should be moved to the test class instead.
@@ -817,6 +818,20 @@ public class JUnitTask extends Task {
}
/**
+ * Throws a <code>BuildException</code> if the given test name is invalid.
+ * Validity is defined as not <code>null</code>, not empty, and not the
+ * string "null".
+ * @param testName the test name to be validated
+ * @throws BuildException if <code>testName</code> is not a valid test name
+ */
+ private void validateTestName(String testName) throws BuildException {
+ if (testName == null || testName.length() == 0
+ || testName.equals("null")) {
+ throw new BuildException("test name must be specified");
+ }
+ }
+
+ /**
* Execute a list of tests in a single forked Java VM.
* @param testList the list of tests to execute.
* @throws BuildException on error.
@@ -1087,8 +1102,7 @@ public class JUnitTask extends Task {
* @return true if the run should be withoutput and error
*/
private boolean equalsWithOutAndErr(String summaryOption) {
- return summaryOption != null && "withoutanderr".equals(
- summaryOption.toLowerCase(Locale.ENGLISH));
+ return "withoutanderr".equalsIgnoreCase(summaryOption);
}
private void checkIncludeSummary(CommandlineJava cmd) {
@@ -1601,7 +1615,7 @@ public class JUnitTask extends Task {
if (summary) {
JUnitTaskMirror.SummaryJUnitResultFormatterMirror f =
delegate.newSummaryJUnitResultFormatter();
- f.setWithOutAndErr("withoutanderr".equalsIgnoreCase(summaryValue));
+ f.setWithOutAndErr(equalsWithOutAndErr(summaryValue));
delegate.addVmExit(test, f, getDefaultOutput(), message, testCase);
}
} finally {
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java Mon May 3 17:44:21 2010
@@ -32,10 +32,12 @@ import java.util.Collection;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
+import java.util.Set;
import java.util.StringTokenizer;
import java.util.Vector;
@@ -54,6 +56,7 @@ import org.apache.tools.ant.types.select
import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.util.RetryHandler;
import org.apache.tools.ant.util.Retryable;
+import org.apache.tools.ant.util.VectorSet;
/**
* Basic FTP client. Performs the following actions:
@@ -116,7 +119,7 @@ public class FTP extends Task implements
private boolean timeDiffAuto = false;
private int action = SEND_FILES;
private Vector filesets = new Vector();
- private Vector dirCache = new Vector();
+ private Set dirCache = new HashSet();
private int transferred = 0;
private String remoteFileSep = "/";
private int port = DEFAULT_FTP_PORT;
@@ -354,12 +357,12 @@ public class FTP extends Task implements
excludes = new String[0];
}
- filesIncluded = new Vector();
+ filesIncluded = new VectorSet();
filesNotIncluded = new Vector();
- filesExcluded = new Vector();
- dirsIncluded = new Vector();
+ filesExcluded = new VectorSet();
+ dirsIncluded = new VectorSet();
dirsNotIncluded = new Vector();
- dirsExcluded = new Vector();
+ dirsExcluded = new VectorSet();
try {
String cwd = ftp.printWorkingDirectory();
@@ -1919,7 +1922,7 @@ public class FTP extends Task implements
+ "directory: " + ftp.getReplyString());
}
}
- dirCache.addElement(dir);
+ dirCache.add(dir);
}
ftp.changeWorkingDirectory(cwd);
}
@@ -2565,8 +2568,7 @@ public class FTP extends Task implements
* @return the SYMBOL representing the given action.
*/
public int getAction() {
- String actionL = getValue().toLowerCase(Locale.US);
-
+ String actionL = getValue().toLowerCase(Locale.ENGLISH);
if (actionL.equals("send") || actionL.equals("put")) {
return SEND_FILES;
} else if (actionL.equals("recv") || actionL.equals("get")) {
@@ -2624,8 +2626,7 @@ public class FTP extends Task implements
* the attribute, in the context of the supplied action
*/
public long getMilliseconds(int action) {
- String granularityU = getValue().toUpperCase(Locale.US);
-
+ String granularityU = getValue().toUpperCase(Locale.ENGLISH);
if ("".equals(granularityU)) {
if (action == SEND_FILES) {
return GRANULARITY_MINUTE;
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTask.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTask.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTask.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTask.java Mon May 3 17:44:21 2010
@@ -862,8 +862,7 @@ public class FTPTask extends Task implem
* @return the SYMBOL representing the given action.
*/
public int getAction() {
- String actionL = getValue().toLowerCase(Locale.US);
-
+ String actionL = getValue().toLowerCase(Locale.ENGLISH);
if (actionL.equals("send") || actionL.equals("put")) {
return SEND_FILES;
} else if (actionL.equals("recv") || actionL.equals("get")) {
@@ -921,8 +920,7 @@ public class FTPTask extends Task implem
* the attribute, in the context of the supplied action
*/
public long getMilliseconds(int action) {
- String granularityU = getValue().toUpperCase(Locale.US);
-
+ String granularityU = getValue().toUpperCase(Locale.ENGLISH);
if ("".equals(granularityU)) {
if (action == SEND_FILES) {
return GRANULARITY_MINUTE;
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTask.java
('svn:mergeinfo' removed)
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java Mon May 3 17:44:21 2010
@@ -50,6 +50,7 @@ import org.apache.tools.ant.types.select
import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.util.RetryHandler;
import org.apache.tools.ant.util.Retryable;
+import org.apache.tools.ant.util.VectorSet;
public class FTPTaskMirrorImpl implements FTPTaskMirror {
@@ -63,7 +64,7 @@ public class FTPTaskMirrorImpl implement
private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
private final FTPTask task;
- private Vector dirCache = new Vector();
+ private Set dirCache = new HashSet();
private int transferred = 0;
private int skipped = 0;
@@ -257,12 +258,12 @@ public class FTPTaskMirrorImpl implement
excludes = new String[0];
}
- filesIncluded = new Vector();
+ filesIncluded = new VectorSet();
filesNotIncluded = new Vector();
- filesExcluded = new Vector();
- dirsIncluded = new Vector();
+ filesExcluded = new VectorSet();
+ dirsIncluded = new VectorSet();
dirsNotIncluded = new Vector();
- dirsExcluded = new Vector();
+ dirsExcluded = new VectorSet();
try {
String cwd = ftp.printWorkingDirectory();
@@ -1310,7 +1311,7 @@ public class FTPTaskMirrorImpl implement
+ "directory: " + ftp.getReplyString());
}
}
- dirCache.addElement(dir);
+ dirCache.add(dir);
}
ftp.changeWorkingDirectory(cwd);
}
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
('svn:mergeinfo' removed)
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/net/RExecTask.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/net/RExecTask.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/net/RExecTask.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/net/RExecTask.java Mon May 3 17:44:21 2010
@@ -205,14 +205,15 @@ public class RExecTask extends Task {
StringBuffer sb = new StringBuffer();
int windowStart = -s.length();
if (timeout == null || timeout.intValue() == 0) {
- while (windowStart++ < 0
+ while (windowStart < 0
|| !sb.substring(windowStart).equals(s)) {
sb.append((char) is.read());
+ windowStart++;
}
} else {
Calendar endTime = Calendar.getInstance();
endTime.add(Calendar.SECOND, timeout.intValue());
- while (windowStart++ < 0
+ while (windowStart < 0
|| !sb.substring(windowStart).equals(s)) {
while (Calendar.getInstance().before(endTime)
&& is.available() == 0) {
@@ -224,6 +225,7 @@ public class RExecTask extends Task {
getLocation());
}
sb.append((char) is.read());
+ windowStart++;
}
}
log(sb.toString(), Project.MSG_INFO);
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java Mon May 3 17:44:21 2010
@@ -342,14 +342,15 @@ public class TelnetTask extends Task {
StringBuffer sb = new StringBuffer();
int windowStart = -s.length();
if (timeout == null || timeout.intValue() == 0) {
- while (windowStart++ < 0
+ while (windowStart < 0
|| !sb.substring(windowStart).equals(s)) {
sb.append((char) is.read());
+ windowStart++;
}
} else {
Calendar endTime = Calendar.getInstance();
endTime.add(Calendar.SECOND, timeout.intValue());
- while (windowStart++ < 0
+ while (windowStart < 0
|| !sb.substring(windowStart).equals(s)) {
while (Calendar.getInstance().before(endTime)
&& is.available() == 0) {
@@ -363,6 +364,7 @@ public class TelnetTask extends Task {
getLocation());
}
sb.append((char) is.read());
+ windowStart++;
}
}
log(sb.toString(), Project.MSG_INFO);
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java Mon May 3 17:44:21 2010
@@ -110,7 +110,7 @@ public class ScriptDef extends DefBase {
* @param name the attribute name
*/
public void setName(String name) {
- this.name = name.toLowerCase(Locale.US);
+ this.name = name.toLowerCase(Locale.ENGLISH);
}
}
@@ -142,7 +142,7 @@ public class ScriptDef extends DefBase {
* @param name the name of this nested element
*/
public void setName(String name) {
- this.name = name.toLowerCase(Locale.US);
+ this.name = name.toLowerCase(Locale.ENGLISH);
}
/**
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Directory.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Directory.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Directory.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Directory.java Mon May 3 17:44:21 2010
@@ -20,6 +20,8 @@ package org.apache.tools.ant.taskdefs.op
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Set;
import java.util.StringTokenizer;
import java.io.File;
@@ -29,7 +31,7 @@ import java.io.File;
public class Directory {
private File directory;
- private ArrayList childDirectories;
+ private Set childDirectories;
private ArrayList files;
private Directory parent;
@@ -48,7 +50,7 @@ public class Directory {
*/
public Directory(File directory , Directory parent) {
this.parent = parent;
- this.childDirectories = new ArrayList();
+ this.childDirectories = new LinkedHashSet();
this.files = new ArrayList();
this.directory = directory;
}
@@ -117,8 +119,8 @@ public class Directory {
* @return the child directory, or null if not found
*/
public Directory getChild(File dir) {
- for (int i = 0; i < childDirectories.size(); i++) {
- Directory current = (Directory) childDirectories.get(i);
+ for (Iterator i = childDirectories.iterator(); i.hasNext(); ) {
+ Directory current = (Directory) i.next();
if (current.getDirectory().equals(dir)) {
return current;
}
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java Mon May 3 17:44:21 2010
@@ -184,7 +184,9 @@ public class Symlink extends DispatchTas
return;
}
log("Removing symlink: " + link);
- SYMLINK_UTILS.deleteSymbolicLink(new File(link), this);
+ SYMLINK_UTILS.deleteSymbolicLink(FILE_UTILS
+ .resolveFile(new File("."), link),
+ this);
} catch (FileNotFoundException fnfe) {
handleError(fnfe.toString());
} catch (IOException ioe) {
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java Mon May 3 17:44:21 2010
@@ -515,7 +515,8 @@ public abstract class MSVSS extends Task
protected String getAutoresponse() {
if (autoResponse == null) {
return FLAG_AUTORESPONSE_DEF;
- } else if (autoResponse.equalsIgnoreCase("Y")) {
+ }
+ if (autoResponse.equalsIgnoreCase("Y")) {
return FLAG_AUTORESPONSE_YES;
} else if (autoResponse.equalsIgnoreCase("N")) {
return FLAG_AUTORESPONSE_NO;
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java Mon May 3 17:44:21 2010
@@ -23,9 +23,6 @@ import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.util.ClasspathUtils;
-import java.util.Locale;
-
-
/**
* Creates the necessary rmic adapter, given basic criteria.
*
@@ -96,27 +93,24 @@ public final class RmicAdapterFactory {
public static RmicAdapter getRmic(String rmicType, Task task,
Path classpath)
throws BuildException {
- //convert to lower case in the English locale,
- String compiler = rmicType.toLowerCase(Locale.ENGLISH);
-
//handle default specially by choosing the sun or kaffe compiler
- if (DEFAULT_COMPILER.equals(compiler) || compiler.length() == 0) {
- compiler = KaffeRmic.isAvailable()
+ if (DEFAULT_COMPILER.equalsIgnoreCase(rmicType) || rmicType.length() == 0) {
+ rmicType = KaffeRmic.isAvailable()
? KaffeRmic.COMPILER_NAME
: SunRmic.COMPILER_NAME;
}
- if (SunRmic.COMPILER_NAME.equals(compiler)) {
+ if (SunRmic.COMPILER_NAME.equalsIgnoreCase(rmicType)) {
return new SunRmic();
- } else if (KaffeRmic.COMPILER_NAME.equals(compiler)) {
+ } else if (KaffeRmic.COMPILER_NAME.equalsIgnoreCase(rmicType)) {
return new KaffeRmic();
- } else if (WLRmic.COMPILER_NAME.equals(compiler)) {
+ } else if (WLRmic.COMPILER_NAME.equalsIgnoreCase(rmicType)) {
return new WLRmic();
- } else if (ForkingSunRmic.COMPILER_NAME.equals(compiler)) {
+ } else if (ForkingSunRmic.COMPILER_NAME.equalsIgnoreCase(rmicType)) {
return new ForkingSunRmic();
- } else if (XNewRmic.COMPILER_NAME.equals(compiler)) {
+ } else if (XNewRmic.COMPILER_NAME.equalsIgnoreCase(rmicType)) {
return new XNewRmic();
}
- //no match? ask for the non-lower-cased type
+ //no match?
return resolveClassName(rmicType,
// Memory leak in line below
task.getProject().createClassLoader(classpath));
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/FilterSet.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/FilterSet.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/FilterSet.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/FilterSet.java Mon May 3 17:44:21 2010
@@ -27,6 +27,7 @@ import java.util.Vector;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.util.FileUtils;
+import org.apache.tools.ant.util.VectorSet;
/**
* A set of filters to be applied to something.
@@ -575,7 +576,7 @@ public class FilterSet extends DataType
String beginToken = getBeginToken();
String endToken = getEndToken();
if (recurseDepth == 0) {
- passedTokens = new Vector();
+ passedTokens = new VectorSet();
}
recurseDepth++;
if (passedTokens.contains(parent) && !duplicateToken) {
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/Path.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/Path.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/Path.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/Path.java Mon May 3 17:44:21 2010
@@ -597,7 +597,7 @@ public class Path extends DataType imple
addExisting(systemBootClasspath);
}
- if (System.getProperty("java.vendor").toLowerCase(Locale.US).indexOf("microsoft") >= 0) {
+ if (System.getProperty("java.vendor").toLowerCase(Locale.ENGLISH).indexOf("microsoft") >= 0) {
// XXX is this code still necessary? is there any 1.2+ port?
// Pull in *.zip from packages directory
FileSet msZipFiles = new FileSet();
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/PatternSet.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/PatternSet.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/PatternSet.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/PatternSet.java Mon May 3 17:44:21 2010
@@ -100,7 +100,6 @@ public class PatternSet extends DataType
* @param cond A property name or expression. If the
* expression evaluates to true or a property of
* its value is present, the name is invalid.
- * @param cond A property name or expression.
* @since Ant 1.8.0
*/
public void setUnless(Object cond) {
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/optional/image/Arc.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/optional/image/Arc.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/optional/image/Arc.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/optional/image/Arc.java Mon May 3 17:44:21 2010
@@ -73,11 +73,11 @@ public class Arc extends BasicShape impl
* @todo refactor using an EnumeratedAttribute
*/
public void setType(String strType) {
- if (strType.toLowerCase().equals("open")) {
+ if (strType.equalsIgnoreCase("open")) {
type = Arc2D.OPEN;
- } else if (strType.toLowerCase().equals("pie")) {
+ } else if (strType.equalsIgnoreCase("pie")) {
type = Arc2D.PIE;
- } else if (strType.toLowerCase().equals("chord")) {
+ } else if (strType.equalsIgnoreCase("chord")) {
type = Arc2D.CHORD;
}
}
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/optional/image/ColorMapper.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/optional/image/ColorMapper.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/optional/image/ColorMapper.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/optional/image/ColorMapper.java Mon May 3 17:44:21 2010
@@ -69,33 +69,31 @@ public final class ColorMapper {
* @todo refactor to use an EnumeratedAttribute (maybe?)
*/
public static Color getColorByName(String colorName) {
- colorName = colorName.toLowerCase();
-
- if (colorName.equals(COLOR_BLACK)) {
+ if (colorName.equalsIgnoreCase(COLOR_BLACK)) {
return Color.black;
- } else if (colorName.equals(COLOR_BLUE)) {
+ } else if (colorName.equalsIgnoreCase(COLOR_BLUE)) {
return Color.blue;
- } else if (colorName.equals(COLOR_CYAN)) {
+ } else if (colorName.equalsIgnoreCase(COLOR_CYAN)) {
return Color.cyan;
- } else if (colorName.equals(COLOR_DARKGRAY) || colorName.equals(COLOR_DARKGREY)) {
+ } else if (colorName.equalsIgnoreCase(COLOR_DARKGRAY) || colorName.equalsIgnoreCase(COLOR_DARKGREY)) {
return Color.darkGray;
- } else if (colorName.equals(COLOR_GRAY) || colorName.equals(COLOR_GREY)) {
+ } else if (colorName.equalsIgnoreCase(COLOR_GRAY) || colorName.equalsIgnoreCase(COLOR_GREY)) {
return Color.gray;
- } else if (colorName.equals(COLOR_LIGHTGRAY) || colorName.equals(COLOR_LIGHTGREY)) {
+ } else if (colorName.equalsIgnoreCase(COLOR_LIGHTGRAY) || colorName.equalsIgnoreCase(COLOR_LIGHTGREY)) {
return Color.lightGray;
- } else if (colorName.equals(COLOR_GREEN)) {
+ } else if (colorName.equalsIgnoreCase(COLOR_GREEN)) {
return Color.green;
- } else if (colorName.equals(COLOR_MAGENTA)) {
+ } else if (colorName.equalsIgnoreCase(COLOR_MAGENTA)) {
return Color.magenta;
- } else if (colorName.equals(COLOR_ORANGE)) {
+ } else if (colorName.equalsIgnoreCase(COLOR_ORANGE)) {
return Color.orange;
- } else if (colorName.equals(COLOR_PINK)) {
+ } else if (colorName.equalsIgnoreCase(COLOR_PINK)) {
return Color.pink;
- } else if (colorName.equals(COLOR_RED)) {
+ } else if (colorName.equalsIgnoreCase(COLOR_RED)) {
return Color.red;
- } else if (colorName.equals(COLOR_WHITE)) {
+ } else if (colorName.equalsIgnoreCase(COLOR_WHITE)) {
return Color.white;
- } else if (colorName.equals(COLOR_YELLOW)) {
+ } else if (colorName.equalsIgnoreCase(COLOR_YELLOW)) {
return Color.yellow;
}
return Color.black;
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/resources/MappedResource.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/resources/MappedResource.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/resources/MappedResource.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/resources/MappedResource.java Mon May 3 17:44:21 2010
@@ -75,4 +75,28 @@ public class MappedResource extends Reso
? null : getResource().as(clazz);
}
+ /**
+ * Get the hash code for this Resource.
+ * @since Ant 1.8.1
+ */
+ public int hashCode() {
+ String n = getName();
+ return n == null ? super.hashCode() : n.hashCode();
+ }
+
+ /**
+ * Equality check based on the resource's name in addition to the
+ * resource itself.
+ * @since Ant 1.8.1
+ */
+ public boolean equals(Object other) {
+ if (other == null || !other.getClass().equals(getClass())) {
+ return false;
+ }
+ MappedResource m = (MappedResource) other;
+ String myName = getName();
+ String otherName = m.getName();
+ return (myName == null ? otherName == null : myName.equals(otherName))
+ && getResource().equals(m.getResource());
+ }
}
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/resources/MappedResourceCollection.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/resources/MappedResourceCollection.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/resources/MappedResourceCollection.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/resources/MappedResourceCollection.java Mon May 3 17:44:21 2010
@@ -17,6 +17,8 @@
*/
package org.apache.tools.ant.types.resources;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.Iterator;
import java.util.Stack;
import org.apache.tools.ant.BuildException;
@@ -28,6 +30,7 @@ import org.apache.tools.ant.types.Resour
import org.apache.tools.ant.types.ResourceCollection;
import org.apache.tools.ant.util.FileNameMapper;
import org.apache.tools.ant.util.IdentityMapper;
+import org.apache.tools.ant.util.MergingMapper;
/**
* Wrapper around a resource collections that maps the names of the
@@ -39,6 +42,9 @@ public class MappedResourceCollection
private ResourceCollection nested = null;
private Mapper mapper = null;
+ private boolean enableMultipleMappings = false;
+ private boolean cache = false;
+ private Collection cachedColl = null;
/**
* Adds the required nested ResourceCollection.
@@ -55,6 +61,7 @@ public class MappedResourceCollection
getLocation());
}
setChecked(false);
+ cachedColl = null;
nested = c;
}
@@ -73,6 +80,7 @@ public class MappedResourceCollection
}
setChecked(false);
mapper = new Mapper(getProject());
+ cachedColl = null;
return mapper;
}
@@ -86,6 +94,29 @@ public class MappedResourceCollection
}
/**
+ * Set method of handling mappers that return multiple
+ * mappings for a given source path.
+ * @param enableMultipleMappings If true the type will
+ * use all the mappings for a given source path, if
+ * false, only the first mapped name is
+ * processed.
+ * By default, this setting is false to provide backward
+ * compatibility with earlier releases.
+ * @since Ant 1.8.1
+ */
+ public void setEnableMultipleMappings(boolean enableMultipleMappings) {
+ this.enableMultipleMappings = enableMultipleMappings;
+ }
+
+ /**
+ * Set whether to cache collections.
+ * @since Ant 1.8.1
+ */
+ public void setCache(boolean cache) {
+ this.cache = cache;
+ }
+
+ /**
* {@inheritDoc}
*/
public boolean isFilesystemOnly() {
@@ -105,7 +136,7 @@ public class MappedResourceCollection
return ((MappedResourceCollection) getCheckedRef()).size();
}
checkInitialized();
- return nested.size();
+ return cacheCollection().size();
}
/**
@@ -116,7 +147,7 @@ public class MappedResourceCollection
return ((MappedResourceCollection) getCheckedRef()).iterator();
}
checkInitialized();
- return new MappedIterator(nested.iterator(), mapper);
+ return cacheCollection().iterator();
}
/**
@@ -140,6 +171,7 @@ public class MappedResourceCollection
(MappedResourceCollection) super.clone();
c.nested = nested;
c.mapper = mapper;
+ c.cachedColl = null;
return c;
} catch (CloneNotSupportedException e) {
throw new BuildException(e);
@@ -180,30 +212,32 @@ public class MappedResourceCollection
dieOnCircularReference();
}
- private static class MappedIterator implements Iterator {
- private final Iterator sourceIterator;
- private final FileNameMapper mapper;
-
- private MappedIterator(Iterator source, Mapper m) {
- sourceIterator = source;
- if (m != null) {
- mapper = m.getImplementation();
+ private synchronized Collection cacheCollection() {
+ if (cachedColl == null || !cache) {
+ cachedColl = getCollection();
+ }
+ return cachedColl;
+ }
+
+ private Collection getCollection() {
+ Collection collected = new ArrayList();
+ FileNameMapper m =
+ mapper != null ? mapper.getImplementation() : new IdentityMapper();
+ for (Iterator iter = nested.iterator(); iter.hasNext(); ) {
+ Resource r = (Resource) iter.next();
+ if (enableMultipleMappings) {
+ String[] n = m.mapFileName(r.getName());
+ if (n != null) {
+ for (int i = 0; i < n.length; i++) {
+ collected.add(new MappedResource(r,
+ new MergingMapper(n[i]))
+ );
+ }
+ }
} else {
- mapper = new IdentityMapper();
+ collected.add(new MappedResource(r, m));
}
}
-
- public boolean hasNext() {
- return sourceIterator.hasNext();
- }
-
- public Object next() {
- return new MappedResource((Resource) sourceIterator.next(),
- mapper);
- }
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
+ return collected;
}
}
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/resources/PropertyResource.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/resources/PropertyResource.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/resources/PropertyResource.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/resources/PropertyResource.java Mon May 3 17:44:21 2010
@@ -24,6 +24,7 @@ import java.io.OutputStream;
import java.io.ByteArrayInputStream;
import org.apache.tools.ant.Project;
+import org.apache.tools.ant.PropertyHelper;
import org.apache.tools.ant.types.Resource;
import org.apache.tools.ant.util.PropertyOutputStream;
@@ -64,16 +65,35 @@ public class PropertyResource extends Re
* @return the value of the specified Property.
*/
public String getValue() {
+ if (isReference()) {
+ return ((PropertyResource) getCheckedRef()).getValue();
+ }
Project p = getProject();
return p == null ? null : p.getProperty(getName());
}
/**
+ * Get the Object value of this PropertyResource.
+ * @return the Object value of the specified Property.
+ * @since Ant 1.8.1
+ */
+ public Object getObjectValue() {
+ if (isReference()) {
+ return ((PropertyResource) getCheckedRef()).getObjectValue();
+ }
+ Project p = getProject();
+ return p == null ? null : PropertyHelper.getProperty(p, getName());
+ }
+
+ /**
* Find out whether this Resource exists.
* @return true if the Property is set, false otherwise.
*/
public boolean isExists() {
- return getValue() != null;
+ if (isReferenceOrProxy()) {
+ return getReferencedOrProxied().isExists();
+ }
+ return getObjectValue() != null;
}
/**
@@ -82,10 +102,24 @@ public class PropertyResource extends Re
* compatibility with java.io.File), or UNKNOWN_SIZE if not known.
*/
public long getSize() {
- if (isReference()) {
- return ((Resource) getCheckedRef()).getSize();
+ if (isReferenceOrProxy()) {
+ return getReferencedOrProxied().getSize();
+ }
+ Object o = getObjectValue();
+ return o == null ? 0L : (long) String.valueOf(o).length();
+ }
+
+ /**
+ * Override to implement equality with equivalent Resources,
+ * since we are capable of proxying them.
+ * @param o object to compare
+ * @return true if equal to o
+ */
+ public boolean equals(Object o) {
+ if (super.equals(o)) {
+ return true;
}
- return isExists() ? (long) getValue().length() : 0L;
+ return isReferenceOrProxy() && getReferencedOrProxied().equals(o);
}
/**
@@ -93,23 +127,20 @@ public class PropertyResource extends Re
* @return hash code as int.
*/
public int hashCode() {
- if (isReference()) {
- return getCheckedRef().hashCode();
+ if (isReferenceOrProxy()) {
+ return getReferencedOrProxied().hashCode();
}
return super.hashCode() * PROPERTY_MAGIC;
}
/**
- * Get the string.
- *
- * @return the string contents of the resource.
- * @since Ant 1.7
+ * {@inheritDoc}
*/
public String toString() {
- if (isReference()) {
- return getCheckedRef().toString();
+ if (isReferenceOrProxy()) {
+ return getReferencedOrProxied().toString();
}
- return String.valueOf(getValue());
+ return getValue();
}
/**
@@ -121,10 +152,11 @@ public class PropertyResource extends Re
* supported for this Resource type.
*/
public InputStream getInputStream() throws IOException {
- if (isReference()) {
- return ((Resource) getCheckedRef()).getInputStream();
+ if (isReferenceOrProxy()) {
+ return getReferencedOrProxied().getInputStream();
}
- return isExists() ? new ByteArrayInputStream(getValue().getBytes()) : UNSET;
+ Object o = getObjectValue();
+ return o == null ? UNSET : new ByteArrayInputStream(String.valueOf(o).getBytes());
}
/**
@@ -136,8 +168,8 @@ public class PropertyResource extends Re
* supported for this Resource type.
*/
public OutputStream getOutputStream() throws IOException {
- if (isReference()) {
- return ((Resource) getCheckedRef()).getOutputStream();
+ if (isReferenceOrProxy()) {
+ return getReferencedOrProxied().getOutputStream();
}
if (isExists()) {
throw new ImmutableResourceException();
@@ -145,4 +177,30 @@ public class PropertyResource extends Re
return new PropertyOutputStream(getProject(), getName());
}
+ /**
+ * Learn whether this PropertyResource either refers to another Resource
+ * or proxies another Resource due to its object property value being said Resource.
+ * @return boolean
+ */
+ protected boolean isReferenceOrProxy() {
+ return isReference() || getObjectValue() instanceof Resource;
+ }
+
+ /**
+ * Get the referenced or proxied Resource, if applicable.
+ * @return Resource
+ * @throws IllegalStateException if this PropertyResource neither proxies nor
+ * references another Resource.
+ */
+ protected Resource getReferencedOrProxied() {
+ if (isReference()) {
+ return (Resource) getCheckedRef(Resource.class, "resource");
+ }
+ Object o = getObjectValue();
+ if (o instanceof Resource) {
+ return (Resource) o;
+ }
+ throw new IllegalStateException(
+ "This PropertyResource does not reference or proxy another Resource");
+ }
}
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/resources/ZipResource.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/resources/ZipResource.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/resources/ZipResource.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/resources/ZipResource.java Mon May 3 17:44:21 2010
@@ -219,7 +219,7 @@ public class ZipResource extends Archive
setDirectory(e.isDirectory());
setSize(e.getSize());
setMode(e.getUnixMode());
- extras = e.getExtraFields();
+ extras = e.getExtraFields(true);
method = e.getMethod();
}
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/selectors/TokenizedPath.java
('svn:mergeinfo' removed)
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/selectors/TokenizedPattern.java
('svn:mergeinfo' removed)
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ChecksumAlgorithm.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ChecksumAlgorithm.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ChecksumAlgorithm.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ChecksumAlgorithm.java Mon May 3 17:44:21 2010
@@ -18,7 +18,7 @@
package org.apache.tools.ant.types.selectors.modifiedselector;
-
+import java.util.Locale;
import java.util.zip.Checksum;
import java.util.zip.CRC32;
import java.util.zip.Adler32;
@@ -76,7 +76,8 @@ public class ChecksumAlgorithm implement
* @param algorithm the digest algorithm to use
*/
public void setAlgorithm(String algorithm) {
- this.algorithm = algorithm;
+ this.algorithm =
+ algorithm != null ? algorithm.toUpperCase(Locale.ENGLISH) : null;
}
@@ -85,9 +86,9 @@ public class ChecksumAlgorithm implement
if (checksum != null) {
return;
}
- if ("CRC".equalsIgnoreCase(algorithm)) {
+ if ("CRC".equals(algorithm)) {
checksum = new CRC32();
- } else if ("ADLER".equalsIgnoreCase(algorithm)) {
+ } else if ("ADLER".equals(algorithm)) {
checksum = new Adler32();
} else {
throw new BuildException(new NoSuchAlgorithmException());
@@ -103,7 +104,7 @@ public class ChecksumAlgorithm implement
* @return <i>true</i> if all is ok, otherwise <i>false</i>.
*/
public boolean isValid() {
- return "CRC".equalsIgnoreCase(algorithm) || "ADLER".equalsIgnoreCase(algorithm);
+ return "CRC".equals(algorithm) || "ADLER".equals(algorithm);
}
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/selectors/modifiedselector/DigestAlgorithm.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/selectors/modifiedselector/DigestAlgorithm.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/selectors/modifiedselector/DigestAlgorithm.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/selectors/modifiedselector/DigestAlgorithm.java Mon May 3 17:44:21 2010
@@ -21,6 +21,7 @@ package org.apache.tools.ant.types.selec
import java.io.File;
import java.io.FileInputStream;
+import java.util.Locale;
import java.security.DigestInputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@@ -92,7 +93,8 @@ public class DigestAlgorithm implements
* @param algorithm the digest algorithm to use
*/
public void setAlgorithm(String algorithm) {
- this.algorithm = algorithm;
+ this.algorithm = algorithm != null
+ ? algorithm.toUpperCase(Locale.ENGLISH) : null;
}
@@ -138,7 +140,7 @@ public class DigestAlgorithm implements
* @return <i>true</i> if all is ok, otherwise <i>false</i>.
*/
public boolean isValid() {
- return "SHA".equalsIgnoreCase(algorithm) || "MD5".equalsIgnoreCase(algorithm);
+ return "SHA".equals(algorithm) || "MD5".equals(algorithm);
}
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java Mon May 3 17:44:21 2010
@@ -20,10 +20,10 @@ package org.apache.tools.ant.types.selec
// Java
+import java.io.File;
import java.util.Comparator;
-import java.util.Vector;
import java.util.Iterator;
-import java.io.File;
+import java.util.Vector;
// Ant
import org.apache.tools.ant.Project;
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/ChainedMapper.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/ChainedMapper.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/ChainedMapper.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/ChainedMapper.java Mon May 3 17:44:21 2010
@@ -24,10 +24,10 @@ import java.util.Iterator;
import java.util.ArrayList;
/**
- * A <CODE>ContainerMapper</CODE> that chains the results of the first
- * nested <CODE>FileNameMapper</CODE>s into sourcefiles for the second,
+ * A <code>ContainerMapper</code> that chains the results of the first
+ * nested <code>FileNameMapper</code>s into sourcefiles for the second,
* the second to the third, and so on, returning the resulting mapped
- * filenames from the last nested <CODE>FileNameMapper</CODE>.
+ * filenames from the last nested <code>FileNameMapper</code>.
*/
public class ChainedMapper extends ContainerMapper {
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/CollectionUtils.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/CollectionUtils.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/CollectionUtils.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/CollectionUtils.java Mon May 3 17:44:21 2010
@@ -209,7 +209,7 @@ public class CollectionUtils {
}
/**
- * Returns a collection containg all elements of the iterator.
+ * Returns a collection containing all elements of the iterator.
*
* @since Ant 1.8.0
*/
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/CompositeMapper.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/CompositeMapper.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/CompositeMapper.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/CompositeMapper.java Mon May 3 17:44:21 2010
@@ -17,21 +17,18 @@
*/
package org.apache.tools.ant.util;
-import java.util.Arrays;
-import java.util.HashSet;
import java.util.Iterator;
-import java.util.LinkedList;
+import java.util.LinkedHashSet;
/**
- * A <CODE>ContainerMapper</CODE> that unites the results of its constituent
- * <CODE>FileNameMapper</CODE>s into a single set of result filenames.
+ * A <code>ContainerMapper</code> that unites the results of its constituent
+ * <code>FileNameMapper</code>s into a single set of result filenames.
*/
public class CompositeMapper extends ContainerMapper {
/** {@inheritDoc}. */
public String[] mapFileName(String sourceFileName) {
- HashSet results = new HashSet();
- LinkedList sortedResults = new LinkedList();
+ LinkedHashSet results = new LinkedHashSet();
FileNameMapper mapper = null;
for (Iterator mIter = getMappers().iterator(); mIter.hasNext();) {
@@ -40,16 +37,13 @@ public class CompositeMapper extends Con
String[] mapped = mapper.mapFileName(sourceFileName);
if (mapped != null) {
for (int i = 0; i < mapped.length; i++) {
- if (!results.contains(mapped[i])) {
- results.add(mapped[i]);
- sortedResults.addLast(mapped[i]);
- }
+ results.add(mapped[i]);
}
}
}
}
return (results.size() == 0) ? null
- : (String[]) sortedResults.toArray(new String[results.size()]);
+ : (String[]) results.toArray(new String[results.size()]);
}
}
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/FileUtils.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/FileUtils.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/FileUtils.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/FileUtils.java Mon May 3 17:44:21 2010
@@ -1223,6 +1223,7 @@ public class FileUtils {
* @since Ant 1.6
*/
public void rename(File from, File to) throws IOException {
+ // identical logic lives in Move.renameFile():
from = normalize(from.getAbsolutePath()).getCanonicalFile();
to = normalize(to.getAbsolutePath());
if (!from.exists()) {
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/FirstMatchMapper.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/FirstMatchMapper.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/FirstMatchMapper.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/FirstMatchMapper.java Mon May 3 17:44:21 2010
@@ -23,8 +23,8 @@ import java.util.Iterator;
import java.util.LinkedList;
/**
- * A <CODE>ContainerMapper</CODE> that returns the results of its
- * first constituent <CODE>FileNameMapper</CODE>s that matches.
+ * A <code>ContainerMapper</code> that returns the results of its
+ * first constituent <code>FileNameMapper</code>s that matches.
*
* @since Ant 1.8.0
*/
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java Mon May 3 17:44:21 2010
@@ -140,7 +140,7 @@ public class LayoutPreservingProperties
public void load(InputStream inStream) throws IOException {
String s = readLines(inStream);
- byte[] ba = s.getBytes("ISO-8859-1");
+ byte[] ba = s.getBytes(ResourceUtils.ISO_8859_1);
ByteArrayInputStream bais = new ByteArrayInputStream(ba);
super.load(bais);
}
@@ -251,7 +251,7 @@ public class LayoutPreservingProperties
}
public void store(OutputStream out, String header) throws IOException {
- OutputStreamWriter osw = new OutputStreamWriter(out, "ISO-8859-1");
+ OutputStreamWriter osw = new OutputStreamWriter(out, ResourceUtils.ISO_8859_1);
int skipLines = 0;
int totalLines = logicalLines.size();
@@ -309,7 +309,7 @@ public class LayoutPreservingProperties
* @param is the stream from which to read the data
*/
private String readLines(InputStream is) throws IOException {
- InputStreamReader isr = new InputStreamReader(is, "ISO-8859-1");
+ InputStreamReader isr = new InputStreamReader(is, ResourceUtils.ISO_8859_1);
BufferedReader br = new BufferedReader(isr);
if (logicalLines.size() > 0) {
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/LeadPipeInputStream.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/LeadPipeInputStream.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/LeadPipeInputStream.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/LeadPipeInputStream.java Mon May 3 17:44:21 2010
@@ -86,14 +86,15 @@ public class LeadPipeInputStream extends
try {
result = super.read();
} catch (IOException eyeOhEx) {
- if ("write end dead".equalsIgnoreCase(eyeOhEx.getMessage())) {
+ String msg = eyeOhEx.getMessage();
+ if ("write end dead".equalsIgnoreCase(msg)) {
if (super.in > 0 && super.out < super.buffer.length
&& super.out > super.in) {
result = super.buffer[super.out++] & BYTE_MASK;
}
} else {
- log("error at LeadPipeInputStream.read(): "
- + eyeOhEx.getMessage(), Project.MSG_INFO);
+ log("error at LeadPipeInputStream.read(): " + msg,
+ Project.MSG_INFO);
}
}
return result;
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/ResourceUtils.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/ResourceUtils.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/ResourceUtils.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/ResourceUtils.java Mon May 3 17:44:21 2010
@@ -66,6 +66,13 @@ public class ResourceUtils {
private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
/**
+ * Name of charset "ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1".
+ *
+ * @since Ant 1.8.1
+ */
+ public static final String ISO_8859_1 = "ISO-8859-1";
+
+ /**
* Tells which source files should be reprocessed based on the
* last modification date of target files.
* @param logTo where to send (more or less) interesting output.
@@ -466,7 +473,7 @@ public class ResourceUtils {
long count = srcChannel.size();
while (position < count) {
position +=
- srcChannel.transferTo(position, FileUtils.BUF_SIZE,
+ srcChannel.transferTo(position, count - position,
destChannel);
}
} finally {
@@ -666,6 +673,9 @@ public class ResourceUtils {
while (expected != null) {
String actual = in2.readLine();
if (!expected.equals(actual)) {
+ if (actual == null) {
+ return 1;
+ }
return expected.compareTo(actual);
}
expected = in1.readLine();
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/ScriptRunnerBase.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/ScriptRunnerBase.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/ScriptRunnerBase.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/ScriptRunnerBase.java Mon May 3 17:44:21 2010
@@ -306,8 +306,8 @@ public abstract class ScriptRunnerBase {
project = component.getProject();
addBeans(project.getProperties());
addBeans(project.getUserProperties());
- addBeans(project.getTargets());
- addBeans(project.getReferences());
+ addBeans(project.getCopyOfTargets());
+ addBeans(project.getCopyOfReferences());
addBean("project", project);
addBean("self", component);
}
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/SymbolicLinkUtils.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/SymbolicLinkUtils.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/SymbolicLinkUtils.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/SymbolicLinkUtils.java Mon May 3 17:44:21 2010
@@ -64,7 +64,7 @@ public class SymbolicLinkUtils {
* canonical and absolute paths of the file are identical--this
* may lead to false positives on some platforms.</p>
*
- * @param file the file to test.
+ * @param file the file to test. Must not be null.
*
* @return true if the file is a symbolic link.
* @throws IOException on error.
@@ -104,7 +104,9 @@ public class SymbolicLinkUtils {
*/
public boolean isSymbolicLink(File parent, String name)
throws IOException {
- File toTest = new File(parent.getCanonicalPath(), name);
+ File toTest = parent != null
+ ? new File(parent.getCanonicalPath(), name)
+ : new File(name);
return !toTest.getAbsolutePath().equals(toTest.getCanonicalPath());
}
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/VectorSet.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/VectorSet.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/VectorSet.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/VectorSet.java Mon May 3 17:44:21 2010
@@ -37,9 +37,25 @@ import java.util.Vector;
*
* @since Ant 1.8.0
*/
-public class VectorSet extends Vector {
+public final class VectorSet extends Vector {
private final HashSet set = new HashSet();
+ public VectorSet() { super(); }
+
+ public VectorSet(int initialCapacity) { super(initialCapacity); }
+
+ public VectorSet(int initialCapacity, int capacityIncrement) {
+ super(initialCapacity, capacityIncrement);
+ }
+
+ public VectorSet(Collection c) {
+ if (c != null) {
+ for (Iterator i = c.iterator(); i.hasNext(); ) {
+ add(i.next());
+ }
+ }
+ }
+
public synchronized boolean add(Object o) {
if (!set.contains(o)) {
doAdd(size(), o);
@@ -137,8 +153,10 @@ public class VectorSet extends Vector {
// shouldn't trust it
if (set.remove(o)) {
int index = indexOf(o);
- System.arraycopy(elementData, index + 1, elementData, index,
- size() - index);
+ if (index < elementData.length - 1) {
+ System.arraycopy(elementData, index + 1, elementData, index,
+ elementData.length - index - 1);
+ }
elementCount--;
return true;
}
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/depend/AbstractAnalyzer.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/depend/AbstractAnalyzer.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/depend/AbstractAnalyzer.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/depend/AbstractAnalyzer.java Mon May 3 17:44:21 2010
@@ -22,6 +22,7 @@ import java.util.Enumeration;
import java.util.Vector;
import java.util.zip.ZipFile;
import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.util.VectorSet;
/**
* An abstract implementation of the analyzer interface providing support
@@ -39,7 +40,7 @@ public abstract class AbstractAnalyzer i
private Path classPath = new Path(null);
/** The list of root classes */
- private Vector rootClasses = new Vector();
+ private final Vector rootClasses = new VectorSet();
/** true if dependencies have been determined */
private boolean determined = false;
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java Mon May 3 17:44:21 2010
@@ -20,7 +20,6 @@ package org.apache.tools.ant.util.option
import org.apache.tools.ant.BuildException;
-
import java.util.Iterator;
import org.apache.tools.ant.util.ScriptRunnerBase;
import org.apache.tools.ant.util.ReflectUtil;