ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r939802 [5/7] - in /ant/core/branches/ANT_SITE: ./ 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-apache-xalan2/ s...
Date Fri, 30 Apr 2010 20:28:12 GMT
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java Fri Apr 30 20:28:06 2010
@@ -530,87 +530,7 @@ public class Translate extends MatchingT
                     if (needsWork) {
                         log("Processing " + srcFiles[j],
                             Project.MSG_DEBUG);
-                        FileOutputStream fos = new FileOutputStream(dest);
-                        BufferedWriter out
-                            = new BufferedWriter(new OutputStreamWriter(fos, destEncoding));
-                        FileInputStream fis = new FileInputStream(src);
-                        BufferedReader in
-                            = new BufferedReader(new InputStreamReader(fis, srcEncoding));
-                        String line;
-                        LineTokenizer lineTokenizer = new LineTokenizer();
-                        lineTokenizer.setIncludeDelims(true);
-                        line = lineTokenizer.getToken(in);
-                        while ((line) != null) {
-                            // 2003-02-21 new replace algorithm by tbee (tbee@tbee.org)
-                            // because it wasn't able to replace something like "@aaa;@bbb;"
-
-                            // is there a startToken
-                            // and there is still stuff following the startToken
-                            int startIndex = line.indexOf(startToken);
-                            while (startIndex >= 0
-                                && (startIndex + startToken.length()) <= line.length()) {
-                                // the new value, this needs to be here
-                                // because it is required to calculate the next position to
-                                // search from at the end of the loop
-                                String replace = null;
-
-                                // we found a starttoken, is there an endtoken following?
-                                // start at token+tokenlength because start and end
-                                // token may be indentical
-                                int endIndex = line.indexOf(
-                                    endToken, startIndex + startToken.length());
-                                if (endIndex < 0) {
-                                    startIndex += 1;
-                                } else {
-                                    // grab the token
-                                    String token = line.substring(
-                                        startIndex + startToken.length(), endIndex);
-
-                                    // If there is a white space or = or :, then
-                                    // it isn't to be treated as a valid key.
-                                    boolean validToken = true;
-                                    for (int k = 0; k < token.length() && validToken; k++) {
-                                        char c = token.charAt(k);
-                                        if (c == ':' || c == '='
-                                            || Character.isSpaceChar(c)) {
-                                            validToken = false;
-                                        }
-                                    }
-                                    if (!validToken) {
-                                        startIndex += 1;
-                                    } else {
-                                        // find the replace string
-                                        if (resourceMap.containsKey(token)) {
-                                            replace = (String) resourceMap.get(token);
-                                        } else {
-                                            log("Replacement string missing for: "
-                                                + token, Project.MSG_VERBOSE);
-                                            replace = startToken + token + endToken;
-                                        }
-
-
-                                        // generate the new line
-                                        line = line.substring(0, startIndex)
-                                             + replace
-                                             + line.substring(endIndex + endToken.length());
-
-                                        // set start position for next search
-                                        startIndex += replace.length();
-                                    }
-                                }
-
-                                // find next starttoken
-                                startIndex = line.indexOf(startToken, startIndex);
-                            }
-                            out.write(line);
-                            line = lineTokenizer.getToken(in);
-                        }
-                        if (in != null) {
-                            in.close();
-                        }
-                        if (out != null) {
-                            out.close();
-                        }
+                        translateOneFile(src, dest);
                         ++filesProcessed;
                     } else {
                         log("Skipping " + srcFiles[j]
@@ -624,4 +544,87 @@ public class Translate extends MatchingT
         }
         log("Translation performed on " + filesProcessed + " file(s).", Project.MSG_DEBUG);
     }
+
+    private void translateOneFile(File src, File dest) throws IOException {
+        BufferedWriter out = null;
+        BufferedReader in = null;
+        try {
+            FileOutputStream fos = new FileOutputStream(dest);
+            out = new BufferedWriter(new OutputStreamWriter(fos, destEncoding));
+            FileInputStream fis = new FileInputStream(src);
+            in = new BufferedReader(new InputStreamReader(fis, srcEncoding));
+            String line;
+            LineTokenizer lineTokenizer = new LineTokenizer();
+            lineTokenizer.setIncludeDelims(true);
+            line = lineTokenizer.getToken(in);
+            while ((line) != null) {
+                // 2003-02-21 new replace algorithm by tbee (tbee@tbee.org)
+                // because it wasn't able to replace something like "@aaa;@bbb;"
+
+                // is there a startToken
+                // and there is still stuff following the startToken
+                int startIndex = line.indexOf(startToken);
+                while (startIndex >= 0
+                       && (startIndex + startToken.length()) <= line.length()) {
+                    // the new value, this needs to be here
+                    // because it is required to calculate the next position to
+                    // search from at the end of the loop
+                    String replace = null;
+
+                    // we found a starttoken, is there an endtoken following?
+                    // start at token+tokenlength because start and end
+                    // token may be indentical
+                    int endIndex = line.indexOf(endToken, startIndex
+                                                + startToken.length());
+                    if (endIndex < 0) {
+                        startIndex += 1;
+                    } else {
+                        // grab the token
+                        String token = line.substring(startIndex
+                                                      + startToken.length(),
+                                                      endIndex);
+
+                        // If there is a white space or = or :, then
+                        // it isn't to be treated as a valid key.
+                        boolean validToken = true;
+                        for (int k = 0; k < token.length() && validToken; k++) {
+                            char c = token.charAt(k);
+                            if (c == ':' || c == '='
+                                || Character.isSpaceChar(c)) {
+                                validToken = false;
+                            }
+                        }
+                        if (!validToken) {
+                            startIndex += 1;
+                        } else {
+                            // find the replace string
+                            if (resourceMap.containsKey(token)) {
+                                replace = (String) resourceMap.get(token);
+                            } else {
+                                log("Replacement string missing for: " + token,
+                                    Project.MSG_VERBOSE);
+                                replace = startToken + token + endToken;
+                            }
+
+
+                            // generate the new line
+                            line = line.substring(0, startIndex) + replace
+                                + line.substring(endIndex + endToken.length());
+
+                            // set start position for next search
+                            startIndex += replace.length();
+                        }
+                    }
+
+                    // find next starttoken
+                    startIndex = line.indexOf(startToken, startIndex);
+                }
+                out.write(line);
+                line = lineTokenizer.getToken(in);
+            }
+        } finally {
+            FileUtils.close(in);
+            FileUtils.close(out);
+        }
+    }
 }

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/image/Image.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/image/Image.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/image/Image.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/image/Image.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java Fri Apr 30 20:28:06 2010
@@ -169,10 +169,14 @@ public class BriefJUnitResultFormatter i
                 output.write(sb.toString());
                 resultWriter.close();
                 output.write(results.toString());
-                output.flush();
             } catch (IOException ex) {
                 throw new BuildException(ex);
             } finally {
+                try {
+                    output.flush();
+                } catch (IOException ex) {
+                    // swallow, there has likely been an exception before this
+                }
                 if (out != System.out && out != System.err) {
                     FileUtils.close(out);
                 }

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java Fri Apr 30 20:28:06 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";
 
@@ -255,9 +256,10 @@ public class FailureRecorder extends Pro
             createSuiteMethod();
             createClassFooter();
 
-            FileUtils.close(writer);
         } catch (IOException e) {
             e.printStackTrace();
+        } finally {
+            FileUtils.close(writer);
         }
     }
 
@@ -365,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/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java Fri Apr 30 20:28:06 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;
@@ -790,6 +789,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.
@@ -814,6 +815,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 &quot;null&quot;.
+     * @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.
@@ -1078,8 +1093,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) {
@@ -1569,7 +1583,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/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java Fri Apr 30 20:28:06 2010
@@ -44,6 +44,7 @@ import junit.framework.TestSuite;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.types.Permissions;
+import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.util.StringUtils;
 import org.apache.tools.ant.util.TeeOutputStream;
 
@@ -898,6 +899,8 @@ public class JUnitTestRunner implements 
             }
         } catch (Exception e) {
             return stack; // return the stack unfiltered
+        } finally {
+            FileUtils.close(pw);
         }
         return sw.toString();
     }
@@ -941,9 +944,7 @@ public class JUnitTestRunner implements 
                 out.write(Constants.TERMINATED_SUCCESSFULLY + "\n");
                 out.flush();
             } finally {
-                if (out != null) {
-                    out.close();
-                }
+                FileUtils.close(out);
             }
         }
     }
@@ -957,9 +958,7 @@ public class JUnitTestRunner implements 
                     out.write(testCase + "\n");
                     out.flush();
                 } finally {
-                    if (out != null) {
-                        out.close();
-                    }
+                    FileUtils.close(out);
                 }
             } catch (IOException e) {
                 // ignored.

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java Fri Apr 30 20:28:06 2010
@@ -169,10 +169,16 @@ public class XMLJUnitResultFormatter imp
                 wri = new BufferedWriter(new OutputStreamWriter(out, "UTF8"));
                 wri.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
                 (new DOMElementWriter()).write(rootElement, wri, 0, "  ");
-                wri.flush();
             } catch (IOException exc) {
                 throw new BuildException("Unable to write log file", exc);
             } finally {
+                if (wri != null) {
+                    try {
+                        wri.flush();
+                    } catch (IOException ex) {
+                        // ignore
+                    }
+                }
                 if (out != System.out && out != System.err) {
                     FileUtils.close(wri);
                 }

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java Fri Apr 30 20:28:06 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();
@@ -1799,9 +1802,7 @@ public class FTP extends Task implements
                 }
             }
         } finally {
-            if (bw != null) {
-                bw.close();
-            }
+            FileUtils.close(bw);
         }
 
         return dsfiles.length;
@@ -1921,7 +1922,7 @@ public class FTP extends Task implements
                                                  + "directory: " + ftp.getReplyString());
                     }
                 }
-                dirCache.addElement(dir);
+                dirCache.add(dir);
             }
             ftp.changeWorkingDirectory(cwd);
         }
@@ -2158,13 +2159,7 @@ public class FTP extends Task implements
                 transferred++;
             }
         } finally {
-            if (instream != null) {
-                try {
-                    instream.close();
-                } catch (IOException ex) {
-                    // ignore it
-                }
-            }
+            FileUtils.close(instream);
         }
     }
 
@@ -2295,13 +2290,7 @@ public class FTP extends Task implements
                 }
             }
         } finally {
-            if (outstream != null) {
-                try {
-                    outstream.close();
-                } catch (IOException ex) {
-                    // ignore it
-                }
-            }
+            FileUtils.close(outstream);
         }
     }
 
@@ -2579,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")) {
@@ -2638,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/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTask.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTask.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTask.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTask.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTask.java
            ('svn:mergeinfo' removed)

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
            ('svn:mergeinfo' removed)

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/net/RExecTask.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/net/RExecTask.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/net/RExecTask.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/net/RExecTask.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java Fri Apr 30 20:28:06 2010
@@ -38,6 +38,7 @@ import org.apache.tools.ant.taskdefs.Log
 import org.apache.tools.ant.taskdefs.LogStreamHandler;
 import org.apache.tools.ant.taskdefs.PumpStreamHandler;
 import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.util.FileUtils;
 
 /**
  *
@@ -205,7 +206,7 @@ public class Pvcs extends org.apache.too
                                     new LogOutputStream(this,
                                                         Project.MSG_WARN)));
             } finally {
-                fos.close();
+                FileUtils.close(fos);
             }
 
             if (Execute.isFailure(result) && !ignorerc) {
@@ -340,9 +341,7 @@ public class Pvcs extends org.apache.too
                 line = in.readLine();
             }
         } finally {
-            if (in != null) {
-                in.close();
-            }
+            FileUtils.close(in);
         }
     }
 
@@ -366,12 +365,8 @@ public class Pvcs extends org.apache.too
                 outWriter.newLine();
             }
         } finally {
-            if (inReader != null) {
-                inReader.close();
-            }
-            if (outWriter != null) {
-                outWriter.close();
-            }
+            FileUtils.close(inReader);
+            FileUtils.close(outWriter);
         }
     }
 

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java Fri Apr 30 20:28:06 2010
@@ -40,8 +40,9 @@ import org.apache.tools.ant.Project;
 /**
  * This class is designed to be used by any AntTask that requires audio output.
  *
- * It implements the BuildListener interface to listen for BuildEvents and could
- * be easily extended to provide audio output upon any specific build events occuring.
+ * It implements the BuildListener interface to listen for BuildEvents
+ * and could be easily extended to provide audio output upon any
+ * specific build events occurring.
  *
  * I have only tested this with .WAV and .AIFF sound file formats. Both seem to work fine.
  *
@@ -139,8 +140,21 @@ public class AntSoundPlayer implements L
     private void playClip(Clip clip, int loops) {
 
         clip.loop(loops);
-        while (clip.isRunning()) {
-            // Empty block
+        do {
+            try {
+                long timeLeft =
+                    (clip.getMicrosecondLength() - clip.getMicrosecondPosition())
+                    / 1000;
+                if (timeLeft > 0) {
+                    Thread.sleep(timeLeft);
+                }
+            } catch (InterruptedException e) {
+                break;
+            }
+        } while (clip.isRunning());
+
+        if (clip.isRunning()) {
+            clip.stop();
         }
     }
 
@@ -151,6 +165,7 @@ public class AntSoundPlayer implements L
         } catch (InterruptedException e) {
             // Ignore Exception
         }
+        clip.stop();
     }
 
     /**
@@ -162,13 +177,6 @@ public class AntSoundPlayer implements L
         if (event.getType().equals(LineEvent.Type.STOP)) {
             Line line = event.getLine();
             line.close();
-        } else if (event.getType().equals(LineEvent.Type.CLOSE)) {
-            /*
-             *  There is a bug in JavaSound 0.90 (jdk1.3beta).
-             *  It prevents correct termination of the VM.
-             *  So we have to exit ourselves.
-             */
-            //System.exit(0);
         }
     }
 

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Directory.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Directory.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Directory.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Directory.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/types/FilterSet.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/FilterSet.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/FilterSet.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/FilterSet.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/types/Path.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/Path.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/Path.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/Path.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/types/PatternSet.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/PatternSet.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/PatternSet.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/PatternSet.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/types/optional/image/Arc.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/optional/image/Arc.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/optional/image/Arc.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/optional/image/Arc.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/types/optional/image/ColorMapper.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/optional/image/ColorMapper.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/optional/image/ColorMapper.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/optional/image/ColorMapper.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/types/resources/MappedResource.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/resources/MappedResource.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/resources/MappedResource.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/resources/MappedResource.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/types/resources/MappedResourceCollection.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/resources/MappedResourceCollection.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/resources/MappedResourceCollection.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/resources/MappedResourceCollection.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/types/resources/PropertyResource.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/resources/PropertyResource.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/resources/PropertyResource.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/resources/PropertyResource.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/types/resources/ZipResource.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/resources/ZipResource.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/resources/ZipResource.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/resources/ZipResource.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/types/selectors/TokenizedPath.java
            ('svn:mergeinfo' removed)

Propchange: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/selectors/TokenizedPattern.java
            ('svn:mergeinfo' removed)

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ChecksumAlgorithm.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ChecksumAlgorithm.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ChecksumAlgorithm.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ChecksumAlgorithm.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/types/selectors/modifiedselector/DigestAlgorithm.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/selectors/modifiedselector/DigestAlgorithm.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/selectors/modifiedselector/DigestAlgorithm.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/selectors/modifiedselector/DigestAlgorithm.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/util/ChainedMapper.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/ChainedMapper.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/ChainedMapper.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/ChainedMapper.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/util/CollectionUtils.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/CollectionUtils.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/CollectionUtils.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/CollectionUtils.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/util/CompositeMapper.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/CompositeMapper.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/CompositeMapper.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/CompositeMapper.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/util/FileUtils.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/FileUtils.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/FileUtils.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/FileUtils.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/util/FirstMatchMapper.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/FirstMatchMapper.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/FirstMatchMapper.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/FirstMatchMapper.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/util/LeadPipeInputStream.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/LeadPipeInputStream.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/LeadPipeInputStream.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/LeadPipeInputStream.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/util/ResourceUtils.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/ResourceUtils.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/ResourceUtils.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/ResourceUtils.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/util/ScriptRunnerBase.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/ScriptRunnerBase.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/ScriptRunnerBase.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/ScriptRunnerBase.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/util/SymbolicLinkUtils.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/SymbolicLinkUtils.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/SymbolicLinkUtils.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/SymbolicLinkUtils.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/util/VectorSet.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/VectorSet.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/VectorSet.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/VectorSet.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/util/depend/AbstractAnalyzer.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/depend/AbstractAnalyzer.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/depend/AbstractAnalyzer.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/depend/AbstractAnalyzer.java Fri Apr 30 20:28:06 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/ANT_SITE/src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java Fri Apr 30 20:28:06 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;



Mime
View raw message