You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by an...@apache.org on 2010/12/13 19:34:09 UTC

svn commit: r1045279 [10/12] - in /ant/core/branches/ANT_SITE: ./ docs/ docs/antlibs/ docs/antlibs/antunit/ docs/antlibs/compress/ docs/antlibs/dotnet/ docs/antlibs/props/ docs/antlibs/svn/ docs/manual/ docs/manual/CoreTasks/ docs/manual/CoreTypes/ doc...

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/selectors/ContainsRegexpSelector.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/selectors/ContainsRegexpSelector.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/selectors/ContainsRegexpSelector.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/selectors/ContainsRegexpSelector.java Mon Dec 13 18:34:00 2010
@@ -24,12 +24,14 @@ import java.io.IOException;
 import java.io.InputStreamReader;
 
 import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
 import org.apache.tools.ant.types.Parameter;
 import org.apache.tools.ant.types.RegularExpression;
 import org.apache.tools.ant.types.Resource;
 import org.apache.tools.ant.types.resources.FileResource;
 import org.apache.tools.ant.types.resources.selectors.ResourceSelector;
 import org.apache.tools.ant.util.regexp.Regexp;
+import org.apache.tools.ant.util.regexp.RegexpUtil;
 
 /**
  * Selector that filters files based on a regular expression.
@@ -42,8 +44,17 @@ public class ContainsRegexpSelector exte
     private String userProvidedExpression = null;
     private RegularExpression myRegExp = null;
     private Regexp myExpression = null;
+    private boolean caseSensitive = true;
+    private boolean multiLine = false;
+    private boolean singleLine = false;
     /** Key to used for parameterized custom selector */
     public static final String EXPRESSION_KEY = "expression";
+    /** Parameter name for the casesensitive attribute. */
+    private static final String CS_KEY = "casesensitive";
+    /** Parameter name for the multiline attribute. */
+    private static final String ML_KEY = "multiline";
+    /** Parameter name for the singleline attribute. */
+    private static final String SL_KEY = "singleline";
 
     /**
      * Creates a new <code>ContainsRegexpSelector</code> instance.
@@ -72,6 +83,34 @@ public class ContainsRegexpSelector exte
     }
 
     /**
+     * Whether to ignore case or not.
+     * @param b if false, ignore case.
+     * @since Ant 1.8.2
+     */
+    public void setCaseSensitive(boolean b) {
+        caseSensitive = b;
+    }
+
+    /**
+     * Whether to match should be multiline.
+     * @param b the value to set.
+     * @since Ant 1.8.2
+     */
+    public void setMultiLine(boolean b) {
+        multiLine = b;
+    }
+
+    /**
+     * Whether to treat input as singleline ('.' matches newline).
+     * Corresponsds to java.util.regex.Pattern.DOTALL.
+     * @param b the value to set.
+     * @since Ant 1.8.2
+     */
+    public void setSingleLine(boolean b) {
+        singleLine = b;
+    }
+
+    /**
      * When using this as a custom selector, this method will be called.
      * It translates each parameter into the appropriate setXXX() call.
      *
@@ -84,6 +123,13 @@ public class ContainsRegexpSelector exte
                 String paramname = parameters[i].getName();
                 if (EXPRESSION_KEY.equalsIgnoreCase(paramname)) {
                     setExpression(parameters[i].getValue());
+                } else if (CS_KEY.equalsIgnoreCase(paramname)) {
+                    setCaseSensitive(Project
+                                     .toBoolean(parameters[i].getValue()));
+                } else if (ML_KEY.equalsIgnoreCase(paramname)) {
+                    setMultiLine(Project.toBoolean(parameters[i].getValue()));
+                } else if (SL_KEY.equalsIgnoreCase(paramname)) {
+                    setSingleLine(Project.toBoolean(parameters[i].getValue()));
                 } else {
                     setError("Invalid parameter " + paramname);
                 }
@@ -148,7 +194,10 @@ public class ContainsRegexpSelector exte
 
             while (teststr != null) {
 
-                if (myExpression.matches(teststr)) {
+                if (myExpression.matches(teststr,
+                                         RegexpUtil.asOptions(caseSensitive,
+                                                              multiLine,
+                                                              singleLine))) {
                     return true;
                 }
                 teststr = in.readLine();

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/selectors/FilenameSelector.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/selectors/FilenameSelector.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/selectors/FilenameSelector.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/types/selectors/FilenameSelector.java Mon Dec 13 18:34:00 2010
@@ -24,6 +24,7 @@ import org.apache.tools.ant.Project;
 import org.apache.tools.ant.types.Parameter;
 import org.apache.tools.ant.types.RegularExpression;
 import org.apache.tools.ant.util.regexp.Regexp;
+import org.apache.tools.ant.util.regexp.RegexpUtil;
 
 /**
  * Selector that filters files based on the filename.
@@ -185,10 +186,7 @@ public class FilenameSelector extends Ba
                 reg.setPattern(regex);
                 expression = reg.getRegexp(getProject());
             }
-            int options = Regexp.MATCH_DEFAULT;
-            if (!casesensitive) {
-                options |= Regexp.MATCH_CASE_INSENSITIVE;
-            }
+            int options = RegexpUtil.asOptions(casesensitive);
             return expression.matches(filename, options) == !negated;
         }
     }

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/DOMElementWriter.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/DOMElementWriter.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/DOMElementWriter.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/DOMElementWriter.java Mon Dec 13 18:34:00 2010
@@ -45,6 +45,13 @@ public class DOMElementWriter {
 
     private static final int HEX = 16;
 
+    private static final String[] WS_ENTITIES = new String['\r' - '\t' + 1];
+    static {
+        for (int i = '\t'; i < '\r' + 1; i++) {
+            WS_ENTITIES[i - '\t'] = "&#x" + Integer.toHexString(i) + ";";
+        }
+    }
+
     /** prefix for generated prefixes */
     private static final String NS = "ns";
 
@@ -332,7 +339,7 @@ public class DOMElementWriter {
             }
             out.write(attr.getName());
             out.write("=\"");
-            out.write(encode(attr.getValue()));
+            out.write(encodeAttributeValue(attr.getValue()));
             out.write("\"");
         }
 
@@ -411,10 +418,25 @@ public class DOMElementWriter {
      * @return the encoded string.
      */
     public String encode(String value) {
-        StringBuffer sb = new StringBuffer();
-        int len = value.length();
+        return encode(value, false);
+    }
+
+    /**
+     * Escape &lt;, &gt; &amp; &apos;, &quot; as their entities, \n,
+     * \r and \t as numeric entities and drop characters that are
+     * illegal in XML documents.
+     * @param value the string to encode.
+     * @return the encoded string.
+     */
+    public String encodeAttributeValue(String value) {
+        return encode(value, true);
+    }
+
+    private String encode(final String value, final boolean encodeWhitespace) {
+        final int len = value.length();
+        final StringBuffer sb = new StringBuffer(len);
         for (int i = 0; i < len; i++) {
-            char c = value.charAt(i);
+            final char c = value.charAt(i);
             switch (c) {
             case '<':
                 sb.append("&lt;");
@@ -429,12 +451,15 @@ public class DOMElementWriter {
                 sb.append("&quot;");
                 break;
             case '&':
-                int nextSemi = value.indexOf(";", i);
-                if (nextSemi < 0
-                    || !isReference(value.substring(i, nextSemi + 1))) {
-                    sb.append("&amp;");
+                sb.append("&amp;");
+                break;
+            case '\r':
+            case '\n':
+            case '\t':
+                if (encodeWhitespace) {
+                    sb.append(WS_ENTITIES[c - '\t']);
                 } else {
-                    sb.append('&');
+                    sb.append(c);
                 }
                 break;
             default:
@@ -464,28 +489,16 @@ public class DOMElementWriter {
 
      */
     public String encodedata(final String value) {
-        StringBuffer sb = new StringBuffer();
-        int len = value.length();
+        final int len = value.length();
+        StringBuffer sb = new StringBuffer(len);
         for (int i = 0; i < len; ++i) {
-            char c = value.charAt(i);
+            final char c = value.charAt(i);
             if (isLegalCharacter(c)) {
                 sb.append(c);
             }
         }
 
-        String result = sb.substring(0);
-        int cdEnd = result.indexOf("]]>");
-        while (cdEnd != -1) {
-            sb.setLength(cdEnd);
-            // CheckStyle:MagicNumber OFF
-            sb.append("&#x5d;&#x5d;&gt;")
-                .append(result.substring(cdEnd + 3));
-            // CheckStyle:MagicNumber ON
-            result = sb.substring(0);
-            cdEnd = result.indexOf("]]>");
-        }
-
-        return result;
+        return StringUtils.replace(sb.substring(0), "]]>", "]]]]><![CDATA[>");
     }
 
     /**
@@ -537,7 +550,7 @@ public class DOMElementWriter {
      * @return true if the character is allowed.
      * @since 1.10, Ant 1.5
      */
-    public boolean isLegalCharacter(char c) {
+    public boolean isLegalCharacter(final char c) {
         // CheckStyle:MagicNumber OFF
         if (c == 0x9 || c == 0xA || c == 0xD) {
             return true;

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=1045279&r1=1045278&r2=1045279&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 Mon Dec 13 18:34:00 2010
@@ -24,7 +24,6 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.Reader;
-import java.io.UnsupportedEncodingException;
 import java.io.Writer;
 import java.net.MalformedURLException;
 import java.net.HttpURLConnection;
@@ -513,12 +512,55 @@ public class FileUtils {
      */
     public void copyFile(File sourceFile, File destFile,
                          FilterSetCollection filters, Vector filterChains,
-                         boolean overwrite, boolean preserveLastModified, boolean append,
+                         boolean overwrite, boolean preserveLastModified,
+                         boolean append,
                          String inputEncoding, String outputEncoding,
                          Project project) throws IOException {
-        ResourceUtils.copyResource(new FileResource(sourceFile), new FileResource(destFile),
-                filters, filterChains, overwrite, preserveLastModified, append, inputEncoding,
-                outputEncoding, project);
+        copyFile(sourceFile, destFile, filters, filterChains, overwrite,
+                 preserveLastModified, append, inputEncoding, outputEncoding,
+                 project, /* force: */ false);
+    }
+
+    /**
+     * Convenience method to copy a file from a source to a
+     * destination specifying if token filtering must be used, if
+     * filter chains must be used, if source files may overwrite
+     * newer destination files and the last modified time of
+     * <code>destFile</code> file should be made equal
+     * to the last modified time of <code>sourceFile</code>.
+     *
+     * @param sourceFile the file to copy from.
+     *                   Must not be <code>null</code>.
+     * @param destFile the file to copy to.
+     *                 Must not be <code>null</code>.
+     * @param filters the collection of filters to apply to this copy.
+     * @param filterChains filterChains to apply during the copy.
+     * @param overwrite Whether or not the destination file should be
+     *                  overwritten if it already exists.
+     * @param preserveLastModified Whether or not the last modified time of
+     *                             the resulting file should be set to that
+     *                             of the source file.
+     * @param append whether to append to the destination file.
+     * @param inputEncoding the encoding used to read the files.
+     * @param outputEncoding the encoding used to write the files.
+     * @param project the project instance.
+     * @param force whether to overwrite read-only destination files.
+     *
+     * @throws IOException if the copying fails.
+     *
+     * @since Ant 1.8.2
+     */
+    public void copyFile(File sourceFile, File destFile,
+                         FilterSetCollection filters, Vector filterChains,
+                         boolean overwrite, boolean preserveLastModified,
+                         boolean append,
+                         String inputEncoding, String outputEncoding,
+                         Project project, boolean force) throws IOException {
+        ResourceUtils.copyResource(new FileResource(sourceFile),
+                                   new FileResource(destFile),
+                                   filters, filterChains, overwrite,
+                                   preserveLastModified, append, inputEncoding,
+                                   outputEncoding, project, force);
     }
 
     // CheckStyle:ParameterNumberCheck ON
@@ -855,6 +897,8 @@ public class FileUtils {
         return createTempFile(prefix, suffix, parentDir, false, false);
     }
 
+    private static final String NULL_PLACEHOLDER = "null";
+
     /**
      * Create a temporary file in a given directory.
      *
@@ -882,6 +926,12 @@ public class FileUtils {
         String parent = (parentDir == null)
                 ? System.getProperty("java.io.tmpdir")
                 : parentDir.getPath();
+        if (prefix == null) {
+            prefix = NULL_PLACEHOLDER;
+        }
+        if (suffix == null) {
+            suffix = NULL_PLACEHOLDER;
+        }
 
         if (createFile) {
             try {
@@ -1206,6 +1256,25 @@ public class FileUtils {
     }
 
     /**
+     * Are the two File instances pointing to the same object on the
+     * file system?
+     * @since Ant 1.8.2
+     */
+    public boolean areSame(File f1, File f2) throws IOException {
+        if (f1 == null && f2 == null) {
+            return true;
+        }
+        if (f1 == null || f2 == null) {
+            return false;
+        }
+        File f1Normalized = normalize(f1.getAbsolutePath());
+        File f2Normalized = normalize(f2.getAbsolutePath());
+        return f1Normalized.equals(f2Normalized)
+            || f1Normalized.getCanonicalFile().equals(f2Normalized
+                                                      .getCanonicalFile());
+    }
+
+    /**
      * Renames a file, even if that involves crossing file system boundaries.
      *
      * <p>This will remove <code>to</code> (if it exists), ensure that
@@ -1230,12 +1299,11 @@ public class FileUtils {
             System.err.println("Cannot rename nonexistent file " + from);
             return;
         }
-        if (from.equals(to)) {
+        if (from.getAbsolutePath().equals(to.getAbsolutePath())) {
             System.err.println("Rename of " + from + " to " + to + " is a no-op.");
             return;
         }
-        if (to.exists() &&
-            !(from.equals(to.getCanonicalFile()) || tryHardToDelete(to))) {
+        if (to.exists() && !(areSame(from, to) || tryHardToDelete(to))) {
             throw new IOException("Failed to delete " + to + " while trying to rename " + from);
         }
         File parent = to.getParentFile();

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=1045279&r1=1045278&r2=1045279&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 Mon Dec 13 18:34:00 2010
@@ -17,10 +17,7 @@
  */
 package org.apache.tools.ant.util;
 
-import java.util.Arrays;
-import java.util.HashSet;
 import java.util.Iterator;
-import java.util.LinkedList;
 
 /**
  * A <code>ContainerMapper</code> that returns the results of its

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/JavaEnvUtils.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/JavaEnvUtils.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/JavaEnvUtils.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/JavaEnvUtils.java Mon Dec 13 18:34:00 2010
@@ -89,8 +89,18 @@ public final class JavaEnvUtils {
     /** Number Version constant for Java 1.6 */
     public static final int VERSION_1_6 = 16;
 
+    /** Version constant for Java 1.7 */
+    public static final String JAVA_1_7 = "1.7";
+    /** Number Version constant for Java 1.7 */
+    public static final int VERSION_1_7 = 17;
+
     /** Whether this is the Kaffe VM */
     private static boolean kaffeDetected;
+    /** Whether this is the GNU VM (gcj/gij) */
+    private static boolean gijDetected;
+
+    /** Whether this is Apache Harmony */
+    private static boolean harmonyDetected;
 
     /** array of packages in the runtime */
     private static Vector jrePackages;
@@ -124,9 +134,12 @@ public final class JavaEnvUtils {
             Class.forName("java.net.Proxy");
             javaVersion = JAVA_1_5;
             javaVersionNumber++;
-            Class.forName("java.util.ServiceLoader");
+            Class.forName("java.net.CookieStore");
             javaVersion = JAVA_1_6;
             javaVersionNumber++;
+            Class.forName("java.nio.file.FileSystem");
+            javaVersion = JAVA_1_7;
+            javaVersionNumber++;
         } catch (Throwable t) {
             // swallow as we've hit the max class version that
             // we have
@@ -138,6 +151,20 @@ public final class JavaEnvUtils {
         } catch (Throwable t) {
             // swallow as this simply doesn't seem to be Kaffe
         }
+        gijDetected = false;
+        try {
+            Class.forName("gnu.gcj.Core");
+            gijDetected = true;
+        } catch (Throwable t) {
+            // swallow as this simply doesn't seem to be gcj/gij
+        }
+        harmonyDetected = false;
+        try {
+            Class.forName("org.apache.harmony.luni.util.Base64");
+            harmonyDetected = true;
+        } catch (Throwable t) {
+            // swallow as this simply doesn't seem to be Apache Harmony
+        }
     }
 
     /**
@@ -199,6 +226,25 @@ public final class JavaEnvUtils {
     }
 
     /**
+     * Checks whether the current Java VM is the GNU interpreter gij
+     * or we are running in a gcj precompiled binary.
+     * @since Ant 1.8.2
+     * @return true if the current Java VM is gcj/gij.
+     */
+    public static boolean isGij() {
+        return gijDetected;
+    }
+
+    /**
+     * Checks whether the current VM is Apache Harmony.
+     * @since Ant 1.8.2
+     * @return true if the current VM is Apache Harmony.
+     */
+    public static boolean isApacheHarmony() {
+        return harmonyDetected;
+    }
+
+    /**
      * Finds an executable that is part of a JRE installation based on
      * the java.home system property.
      *
@@ -324,6 +370,7 @@ public final class JavaEnvUtils {
     private static void buildJrePackages() {
         jrePackages = new Vector();
         switch(javaVersionNumber) {
+            case VERSION_1_7:
             case VERSION_1_6:
             case VERSION_1_5:
                 //In Java1.5, the apache stuff moved.
@@ -374,6 +421,7 @@ public final class JavaEnvUtils {
         Vector tests = new Vector();
         tests.addElement("java.lang.Object");
         switch(javaVersionNumber) {
+            case VERSION_1_7:
             case VERSION_1_6:
             case VERSION_1_5:
                 tests.addElement(

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=1045279&r1=1045278&r2=1045279&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 Mon Dec 13 18:34:00 2010
@@ -27,8 +27,8 @@ import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.PrintStream;
+import java.io.PushbackReader;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Properties;
@@ -78,7 +78,7 @@ import java.util.Properties;
  * although the key-value pair <code>beta=two</code> is removed.</p>
  */
 public class LayoutPreservingProperties extends Properties {
-    private static final String LS = System.getProperty("line.separator");
+    private String LS = StringUtils.LINE_SEP;
 
     /**
      * Logical lines have escaping and line continuation taken care
@@ -310,14 +310,15 @@ public class LayoutPreservingProperties 
      */
     private String readLines(InputStream is) throws IOException {
         InputStreamReader isr = new InputStreamReader(is, ResourceUtils.ISO_8859_1);
-        BufferedReader br = new BufferedReader(isr);
+        PushbackReader pbr = new PushbackReader(isr, 1);
 
         if (logicalLines.size() > 0) {
             // we add a blank line for spacing
             logicalLines.add(new Blank());
         }
 
-        String s = br.readLine();
+        String s = readFirstLine(pbr);
+        BufferedReader br = new BufferedReader(pbr);
 
         boolean continuation = false;
         boolean comment = false;
@@ -367,6 +368,46 @@ public class LayoutPreservingProperties 
     }
 
     /**
+     * Reads the first line and determines the EOL-style of the file
+     * (relies on the style to be consistent, of course).
+     *
+     * <p>Sets LS as a side-effect.</p>
+     *
+     * @return the first line without any line separator, leaves the
+     * reader positioned after the first line separator
+     *
+     * @since Ant 1.8.2
+     */
+    private String readFirstLine(PushbackReader r) throws IOException {
+        StringBuffer sb = new StringBuffer(80);
+        int ch = r.read();
+        boolean hasCR = false;
+        // when reaching EOF before the first EOL, assume native line
+        // feeds
+        LS = StringUtils.LINE_SEP;
+
+        while (ch >= 0) {
+            if (hasCR && ch != '\n') {
+                // line feed is sole CR
+                r.unread(ch);
+                break;
+            }
+
+            if (ch == '\r') {
+                LS = "\r";
+                hasCR = true;
+            } else if (ch == '\n') {
+                LS = hasCR ? "\r\n" : "\n";
+                break;
+            } else {
+                sb.append((char) ch);
+            }
+            ch = r.read();
+        }
+        return sb.toString();
+    }
+
+    /**
      * Returns <code>true</code> if the line represented by
      * <code>s</code> is to be continued on the next line of the file,
      * or <code>false</code> otherwise.

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java Mon Dec 13 18:34:00 2010
@@ -22,6 +22,7 @@ import java.util.Vector;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.util.regexp.RegexpMatcher;
 import org.apache.tools.ant.util.regexp.RegexpMatcherFactory;
+import org.apache.tools.ant.util.regexp.RegexpUtil;
 
 /**
  * Implementation of FileNameMapper that does regular expression
@@ -67,11 +68,7 @@ public class RegexpPatternMapper impleme
      * @since Ant 1.6.3
      */
     public void setCaseSensitive(boolean caseSensitive) {
-        if (!caseSensitive) {
-            regexpOptions = RegexpMatcher.MATCH_CASE_INSENSITIVE;
-        } else {
-            regexpOptions = 0;
-        }
+        regexpOptions = RegexpUtil.asOptions(caseSensitive);
     }
 
     /**

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=1045279&r1=1045278&r2=1045279&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 Mon Dec 13 18:34:00 2010
@@ -72,6 +72,8 @@ public class ResourceUtils {
      */
     public static final String ISO_8859_1 = "ISO-8859-1";
 
+    private static final long MAX_IO_CHUNK_SIZE = 16*1024*1024; // 16 MB
+
     /**
      * Tells which source files should be reprocessed based on the
      * last modification date of target files.
@@ -339,10 +341,51 @@ public class ResourceUtils {
      */
     public static void copyResource(Resource source, Resource dest,
                             FilterSetCollection filters, Vector filterChains,
-                            boolean overwrite, boolean preserveLastModified, boolean append,
+                            boolean overwrite, boolean preserveLastModified,
+                                    boolean append,
                             String inputEncoding, String outputEncoding,
                             Project project)
         throws IOException {
+        copyResource(source, dest, filters, filterChains, overwrite,
+                     preserveLastModified, append, inputEncoding,
+                     outputEncoding, project, /* force: */ false);
+    }
+
+    /**
+     * Convenience method to copy content from one Resource to another
+     * specifying whether token filtering must be used, whether filter chains
+     * must be used, whether newer destination files may be overwritten and
+     * whether the last modified time of <code>dest</code> file should be made
+     * equal to the last modified time of <code>source</code>.
+     *
+     * @param source the Resource to copy from.
+     *                   Must not be <code>null</code>.
+     * @param dest   the Resource to copy to.
+     *                 Must not be <code>null</code>.
+     * @param filters the collection of filters to apply to this copy.
+     * @param filterChains filterChains to apply during the copy.
+     * @param overwrite Whether or not the destination Resource should be
+     *                  overwritten if it already exists.
+     * @param preserveLastModified Whether or not the last modified time of
+     *                             the destination Resource should be set to that
+     *                             of the source.
+     * @param append Whether to append to an Appendable Resource.
+     * @param inputEncoding the encoding used to read the files.
+     * @param outputEncoding the encoding used to write the files.
+     * @param project the project instance.
+     * @param force whether read-only taret files will be overwritten
+     *
+     * @throws IOException if the copying fails.
+     *
+     * @since Ant 1.8.2
+     */
+    public static void copyResource(Resource source, Resource dest,
+                            FilterSetCollection filters, Vector filterChains,
+                            boolean overwrite, boolean preserveLastModified,
+                                    boolean append,
+                                    String inputEncoding, String outputEncoding,
+                                    Project project, boolean force)
+        throws IOException {
         if (!(overwrite || SelectorUtils.isOutOfDate(source, dest, FileUtils.getFileUtils()
                 .getFileTimestampGranularity()))) {
             return;
@@ -351,6 +394,21 @@ public class ResourceUtils {
                                              && filters.hasFilters());
         final boolean filterChainsAvailable = (filterChains != null
                                                && filterChains.size() > 0);
+
+        File destFile = null;
+        if (dest.as(FileProvider.class) != null) {
+            destFile = ((FileProvider) dest.as(FileProvider.class)).getFile();
+        }
+        if (destFile != null && destFile.isFile() && !destFile.canWrite()) {
+            if (!force) {
+                throw new IOException("can't write to read-only destination "
+                                      + "file " + destFile);
+            } else if (!FILE_UTILS.tryHardToDelete(destFile)) {
+                throw new IOException("failed to delete read-only "
+                                      + "destination file " + destFile);
+            }
+        }
+
         if (filterSetsAvailable) {
             BufferedReader in = null;
             BufferedWriter out = null;
@@ -444,11 +502,9 @@ public class ResourceUtils {
                 FileUtils.close(in);
             }
         } else if (source.as(FileProvider.class) != null
-                   && dest.as(FileProvider.class) != null) {
+                   && destFile != null) {
             File sourceFile =
                 ((FileProvider) source.as(FileProvider.class)).getFile();
-            File destFile =
-                ((FileProvider) dest.as(FileProvider.class)).getFile();
 
             File parent = destFile.getParentFile();
             if (parent != null && !parent.isDirectory()
@@ -472,9 +528,9 @@ public class ResourceUtils {
                 long position = 0;
                 long count = srcChannel.size();
                 while (position < count) {
+                    long chunk = Math.min(MAX_IO_CHUNK_SIZE, count - position);
                     position +=
-                        srcChannel.transferTo(position, count - position,
-                                              destChannel);
+                        destChannel.transferFrom(srcChannel, position, chunk);
                 }
             } finally {
                 FileUtils.close(srcChannel);

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/StringUtils.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/StringUtils.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/StringUtils.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/StringUtils.java Mon Dec 13 18:34:00 2010
@@ -17,6 +17,8 @@
  */
 package org.apache.tools.ant.util;
 
+import org.apache.tools.ant.BuildException;
+
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.util.Vector;
@@ -239,7 +241,11 @@ public final class StringUtils {
             }
             humanSize = humanSize.substring(0, humanSize.length() - trim);
         }
-        return factor * Long.parseLong(humanSize);
+        try {
+            return factor * Long.parseLong(humanSize);
+        } catch (NumberFormatException e) {
+            throw new BuildException("Failed to parse \"" + humanSize + "\"", e);
+        }
     }
 
     /**

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=1045279&r1=1045278&r2=1045279&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 Mon Dec 13 18:34:00 2010
@@ -21,7 +21,6 @@ import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FilenameFilter;
 import java.io.IOException;
-import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Task;
 import org.apache.tools.ant.taskdefs.Execute;
 

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=1045279&r1=1045278&r2=1045279&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 Mon Dec 13 18:34:00 2010
@@ -76,13 +76,13 @@ public final class VectorSet extends Vec
         // Vector.add seems to delegate to insertElementAt, but this
         // is not documented so we may better implement it ourselves
         if (set.add(o)) {
-            ensureCapacity(size() + 1);
-            Object[] elems = new Object[elementData.length];
-            System.arraycopy(elementData, 0, elems, 0, index);
-            elems[index] = o;
-            System.arraycopy(elementData, index, elems, index + 1,
-                             size() - index);
-            elementData = elems;
+            int count = size();
+            ensureCapacity(count + 1);
+            if (index != count) {
+                System.arraycopy(elementData, index, elementData, index + 1,
+                                 count - index);
+            }
+            elementData[index] = o;
             elementCount++;
         }
     }

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=1045279&r1=1045278&r2=1045279&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 Mon Dec 13 18:34:00 2010
@@ -22,7 +22,6 @@ import org.apache.tools.ant.BuildExcepti
 
 import java.util.Iterator;
 import org.apache.tools.ant.util.ScriptRunnerBase;
-import org.apache.tools.ant.util.ReflectUtil;
 import org.apache.tools.ant.util.ReflectWrapper;
 
 /**

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/regexp/RegexpUtil.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/regexp/RegexpUtil.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/regexp/RegexpUtil.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/util/regexp/RegexpUtil.java Mon Dec 13 18:34:00 2010
@@ -46,4 +46,64 @@ public class RegexpUtil {
     public static int removeFlag(int options, int flag) {
         return (options & (0xFFFFFFFF - flag));
     }
+
+    /**
+     * convert regex option flag characters to regex options
+     * <dl>
+     *   <li>g -  Regexp.REPLACE_ALL</li>
+     *   <li>i -  RegexpMatcher.MATCH_CASE_INSENSITIVE</li>
+     *   <li>m -  RegexpMatcher.MATCH_MULTILINE</li>
+     *   <li>s -  RegexpMatcher.MATCH_SINGLELINE</li>
+     * </dl>
+     * @param flags the string containing the flags
+     * @return the Regexp option bits
+     * @since Ant 1.8.2
+     */
+    public static int asOptions(String flags) {
+        int options = RegexpMatcher.MATCH_DEFAULT;
+        if (flags != null) {
+            options = asOptions(flags.indexOf('i') == -1,
+                                flags.indexOf('m') != -1,
+                                flags.indexOf('s') != -1);
+            if (flags.indexOf('g') != -1) {
+                options |= Regexp.REPLACE_ALL;
+            }
+        }
+        return options;
+    }
+
+    /**
+     * Convert flag to regex options.
+     *
+     * @param caseSensitive opposite of RegexpMatcher.MATCH_CASE_INSENSITIVE
+     * @return the Regexp option bits
+     * @since Ant 1.8.2
+     */
+    public static int asOptions(boolean caseSensitive) {
+        return asOptions(caseSensitive, false, false);
+    }
+
+    /**
+     * Convert flags to regex options.
+     *
+     * @param caseSensitive opposite of RegexpMatcher.MATCH_CASE_INSENSITIVE
+     * @param multiLine RegexpMatcher.MATCH_MULTILINE
+     * @param singleLine RegexpMatcher.MATCH_SINGLELINE
+     * @return the Regexp option bits
+     * @since Ant 1.8.2
+     */
+    public static int asOptions(boolean caseSensitive, boolean multiLine,
+                                boolean singleLine) {
+        int options = RegexpMatcher.MATCH_DEFAULT;
+        if (!caseSensitive) {
+            options = options | RegexpMatcher.MATCH_CASE_INSENSITIVE;
+        }
+        if (multiLine) {
+            options = options | RegexpMatcher.MATCH_MULTILINE;
+        }
+        if (singleLine) {
+            options = options | RegexpMatcher.MATCH_SINGLELINE;
+        }
+        return options;
+    }
 }

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/bzip2/CBZip2InputStream.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/bzip2/CBZip2InputStream.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/bzip2/CBZip2InputStream.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/bzip2/CBZip2InputStream.java Mon Dec 13 18:34:00 2010
@@ -23,7 +23,6 @@
  */
 package org.apache.tools.bzip2;
 
-import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/tar/TarBuffer.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/tar/TarBuffer.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/tar/TarBuffer.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/tar/TarBuffer.java Mon Dec 13 18:34:00 2010
@@ -418,7 +418,7 @@ public class TarBuffer {
     /**
      * Flush the current data block if it has any data in it.
      */
-    private void flushBlock() throws IOException {
+    void flushBlock() throws IOException {
         if (debug) {
             System.err.println("TarBuffer.flushBlock() called.");
         }

Propchange: ant/core/branches/ANT_SITE/src/main/org/apache/tools/tar/TarBuffer.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Dec 13 18:34:00 2010
@@ -0,0 +1,2 @@
+/ant/core/trunk/src/main/org/apache/tools/tar/TarBuffer.java:904538-939797,939803-1045116
+/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarBuffer.java:1027427

Propchange: ant/core/branches/ANT_SITE/src/main/org/apache/tools/tar/TarEntry.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 13 18:34:00 2010
@@ -1,2 +1,2 @@
-/ant/core/trunk/src/main/org/apache/tools/tar/TarEntry.java:904538-939797
+/ant/core/trunk/src/main/org/apache/tools/tar/TarEntry.java:904538-939797,939803-1045116
 /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java:755227,755472

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/tar/TarOutputStream.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/tar/TarOutputStream.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/tar/TarOutputStream.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/tar/TarOutputStream.java Mon Dec 13 18:34:00 2010
@@ -132,6 +132,7 @@ public class TarOutputStream extends Fil
         // http://issues.apache.org/bugzilla/show_bug.cgi?id=28776
         writeEOFRecord();
         writeEOFRecord();
+        buffer.flushBlock();
     }
 
     /**

Propchange: ant/core/branches/ANT_SITE/src/main/org/apache/tools/tar/TarOutputStream.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Dec 13 18:34:00 2010
@@ -0,0 +1,2 @@
+/ant/core/trunk/src/main/org/apache/tools/tar/TarOutputStream.java:904538-939797,939803-1045116
+/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java:1027427

Propchange: ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 13 18:34:00 2010
@@ -1,2 +1,2 @@
-/ant/core/trunk/src/main/org/apache/tools/zip:904538-939797
+/ant/core/trunk/src/main/org/apache/tools/zip:904538-939797,939803-1045116
 /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip:746933,748133,749524,749855,749859

Propchange: ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/AbstractUnicodeExtraField.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 13 18:34:00 2010
@@ -1,2 +1,2 @@
-/ant/core/trunk/src/main/org/apache/tools/zip/AbstractUnicodeExtraField.java:738844,739300,741089,904538-939797
+/ant/core/trunk/src/main/org/apache/tools/zip/AbstractUnicodeExtraField.java:738844,739300,741089,904538-939797,939803-1045116
 /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/AbstractUnicodeExtraField.java:746933,748063,748133,748288,749342,749524,749855,749859

Propchange: ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/ExtraFieldUtils.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 13 18:34:00 2010
@@ -1,3 +1,3 @@
-/ant/core/trunk/src/main/org/apache/tools/zip/ExtraFieldUtils.java:904538-939797
+/ant/core/trunk/src/main/org/apache/tools/zip/ExtraFieldUtils.java:904538-939797,939803-1045116
 /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java:910483-910521
 /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java:745528,746933,748133,749524,749603,749855,749859

Propchange: ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/FallbackZipEncoding.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 13 18:34:00 2010
@@ -1,2 +1,2 @@
-/ant/core/trunk/src/main/org/apache/tools/zip/FallbackZipEncoding.java:738844,739300,741089,904538-939797
+/ant/core/trunk/src/main/org/apache/tools/zip/FallbackZipEncoding.java:738844,739300,741089,904538-939797,939803-1045116
 /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/FallbackZipEncoding.java:749524,749855,749859

Propchange: ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/NioZipEncoding.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 13 18:34:00 2010
@@ -1,2 +1,2 @@
-/ant/core/trunk/src/main/org/apache/tools/zip/NioZipEncoding.java:738844,739300,741089,904538-939797
+/ant/core/trunk/src/main/org/apache/tools/zip/NioZipEncoding.java:738844,739300,741089,904538-939797,939803-1045116
 /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java:749524,749855,749859

Propchange: ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/Simple8BitZipEncoding.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 13 18:34:00 2010
@@ -1,2 +1,2 @@
-/ant/core/trunk/src/main/org/apache/tools/zip/Simple8BitZipEncoding.java:904538-939797
+/ant/core/trunk/src/main/org/apache/tools/zip/Simple8BitZipEncoding.java:904538-939797,939803-1045116
 /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/Simple8BitZipEncoding.java:749524,749855,749859

Propchange: ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/UnicodeCommentExtraField.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 13 18:34:00 2010
@@ -1,2 +1,2 @@
-/ant/core/trunk/src/main/org/apache/tools/zip/UnicodeCommentExtraField.java:738844,739300,741089,904538-939797
+/ant/core/trunk/src/main/org/apache/tools/zip/UnicodeCommentExtraField.java:738844,739300,741089,904538-939797,939803-1045116
 /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/UnicodeCommentExtraField.java:746933,748063,748133,749342,749524,749855,749859

Propchange: ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/UnicodePathExtraField.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 13 18:34:00 2010
@@ -1,2 +1,2 @@
-/ant/core/trunk/src/main/org/apache/tools/zip/UnicodePathExtraField.java:738844,739300,741089,904538-939797
+/ant/core/trunk/src/main/org/apache/tools/zip/UnicodePathExtraField.java:738844,739300,741089,904538-939797,939803-1045116
 /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/UnicodePathExtraField.java:746933,748063,748133,749342,749524,749855,749859

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/UnparseableExtraFieldData.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/UnparseableExtraFieldData.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/UnparseableExtraFieldData.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/UnparseableExtraFieldData.java Mon Dec 13 18:34:00 2010
@@ -22,9 +22,11 @@ package org.apache.tools.zip;
  * Wrapper for extra field data that doesn't conform to the recommended format of header-tag + size + data.
  *
  * <p>The header-id is artificial (and not listed as a know ID in
- * {@link http://www.pkware.com/documents/casestudies/APPNOTE.TXT
- * APPNOTE.TXT}.  Since it isn't used anywhere except to satisfy the
+ * the .ZIP File Format Specification).  
+ * Since it isn't used anywhere except to satisfy the
  * ZipExtraField contract it shouldn't matter anyway.</p>
+ * @see <a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT
+ * APPNOTE.TXT">.ZIP File Format Specification</a>
  * @since Ant 1.8.1
  */
 public final class UnparseableExtraFieldData

Propchange: ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/UnparseableExtraFieldData.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 13 18:34:00 2010
@@ -0,0 +1 @@
+/ant/core/trunk/src/main/org/apache/tools/zip/UnparseableExtraFieldData.java:939803-1045116

Propchange: ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/UnrecognizedExtraField.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 13 18:34:00 2010
@@ -1,3 +1,3 @@
-/ant/core/trunk/src/main/org/apache/tools/zip/UnrecognizedExtraField.java:904538-939797
+/ant/core/trunk/src/main/org/apache/tools/zip/UnrecognizedExtraField.java:904538-939797,939803-1045116
 /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/UnrecognizedExtraField.java:910483-910521
 /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/UnrecognizedExtraField.java:746933,748133,749603,749855,749859

Propchange: ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/ZipEncoding.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 13 18:34:00 2010
@@ -1,2 +1,2 @@
-/ant/core/trunk/src/main/org/apache/tools/zip/ZipEncoding.java:738844,739300,741089,904538-939797
+/ant/core/trunk/src/main/org/apache/tools/zip/ZipEncoding.java:738844,739300,741089,904538-939797,939803-1045116
 /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncoding.java:749524,749855,749859

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/ZipEncodingHelper.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/ZipEncodingHelper.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/ZipEncodingHelper.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/ZipEncodingHelper.java Mon Dec 13 18:34:00 2010
@@ -22,7 +22,6 @@ import java.nio.ByteBuffer;
 import java.nio.charset.Charset;
 import java.nio.charset.UnsupportedCharsetException;
 import java.util.HashMap;
-import java.util.Locale;
 import java.util.Map;
 
 /**

Propchange: ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/ZipEncodingHelper.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 13 18:34:00 2010
@@ -1,3 +1,3 @@
-/ant/core/trunk/src/main/org/apache/tools/zip/ZipEncodingHelper.java:738844,739300,741089,904538-939797
+/ant/core/trunk/src/main/org/apache/tools/zip/ZipEncodingHelper.java:738844,739300,741089,904538-939797,939803-1045116
 /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java:909456
 /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java:746933,747841,748133,749342-749344,749524,749855,749859

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/ZipEntry.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/ZipEntry.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/ZipEntry.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/ZipEntry.java Mon Dec 13 18:34:00 2010
@@ -19,7 +19,6 @@
 package org.apache.tools.zip;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.zip.ZipException;

Propchange: ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/ZipEntry.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 13 18:34:00 2010
@@ -1,4 +1,4 @@
-/ant/core/trunk/src/main/org/apache/tools/zip/ZipEntry.java:904538-939797
+/ant/core/trunk/src/main/org/apache/tools/zip/ZipEntry.java:904538-939797,939803-1045116
 /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java:910483-910521
 /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java:747850,749603
 /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipEntry.java:746933,748133,749524,749855,749859

Propchange: ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/ZipFile.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 13 18:34:00 2010
@@ -1,3 +1,3 @@
-/ant/core/trunk/src/main/org/apache/tools/zip/ZipFile.java:904538-939797
+/ant/core/trunk/src/main/org/apache/tools/zip/ZipFile.java:904538-939797,939803-1045116
 /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java:911740
 /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java:745920,746933,748133,748556,749342-749344,749524,749603,749855,749859

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/ZipLong.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/ZipLong.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/ZipLong.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/ZipLong.java Mon Dec 13 18:34:00 2010
@@ -26,7 +26,6 @@ package org.apache.tools.zip;
 public final class ZipLong implements Cloneable {
 
     private static final int WORD = 4;
-    private static final int BYTE_BIT_SIZE = 8;
     private static final int BYTE_MASK = 0xFF;
 
     private static final int BYTE_1 = 1;

Propchange: ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/ZipOutputStream.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 13 18:34:00 2010
@@ -1,3 +1,3 @@
-/ant/core/trunk/src/main/org/apache/tools/zip/ZipOutputStream.java:904538-939797
+/ant/core/trunk/src/main/org/apache/tools/zip/ZipOutputStream.java:904538-939797,939803-1045116
 /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java:911740
 /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java:745920,747810,747841,748063,749342,749906-749907,750055,750310

Propchange: ant/core/branches/ANT_SITE/src/main/org/apache/tools/zip/ZipUtil.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 13 18:34:00 2010
@@ -0,0 +1 @@
+/ant/core/trunk/src/main/org/apache/tools/zip/ZipUtil.java:939803-1045116

Modified: ant/core/branches/ANT_SITE/src/script/ant.bat
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/script/ant.bat?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/script/ant.bat (original)
+++ ant/core/branches/ANT_SITE/src/script/ant.bat Mon Dec 13 18:34:00 2010
@@ -191,13 +191,6 @@ if not "%_ANT_CMD_LINE_ARGS%"=="" set AN
 
 if "%ANT_ERROR%"=="0" goto mainEnd
 
-rem Set the return code if we are not in NT.  We can only set
-rem a value of 1, but it's better than nothing.
-if not "%OS%"=="Windows_NT" echo 1 > nul | choice /n /c:1
-
-rem Set the ERRORLEVEL if we are running NT.
-if "%OS%"=="Windows_NT" color 00
-
 goto omega
 
 :mainEnd
@@ -222,3 +215,4 @@ if exist "%USERPROFILE%\antrc_post.bat" 
 
 :omega
 
+exit /b %ANT_ERROR%

Modified: ant/core/branches/ANT_SITE/src/script/runant.py
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/script/runant.py?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/script/runant.py (original)
+++ ant/core/branches/ANT_SITE/src/script/runant.py Mon Dec 13 18:34:00 2010
@@ -86,11 +86,11 @@ if os.environ.has_key('ANT_ARGS'):
 
 CLASSPATH = ""
 if os.environ.has_key('CLASSPATH'):
-    CLASSPATH = os.environ['CLASSPATH']
+    CLASSPATH = "-lib " + os.environ['CLASSPATH']
 
 # Builds the commandline
 cmdline = ('%s %s -classpath %s -Dant.home=%s %s ' + \
-    'org.apache.tools.ant.launch.Launcher %s -lib %s %s') \
+    'org.apache.tools.ant.launch.Launcher %s %s %s') \
      % (JAVACMD, ANT_OPTS, LOCALCLASSPATH, ANT_HOME, OPTS, ANT_ARGS, \
         CLASSPATH, string.join(sys.argv[1:], ' '))
 

Modified: ant/core/branches/ANT_SITE/src/tests/antunit/antunit-base.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/tests/antunit/antunit-base.xml?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/tests/antunit/antunit-base.xml (original)
+++ ant/core/branches/ANT_SITE/src/tests/antunit/antunit-base.xml Mon Dec 13 18:34:00 2010
@@ -19,6 +19,7 @@
 
   <property name="input" location="${java.io.tmpdir}/testinput"/>
   <property name="output" location="${java.io.tmpdir}/testoutput"/>
+  <available property="jdk1.6+" classname="java.util.ServiceLoader"/>
 
   <target name="tearDown">
     <delete dir="${input}"/>

Modified: ant/core/branches/ANT_SITE/src/tests/antunit/core/extension-point-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/tests/antunit/core/extension-point-test.xml?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/tests/antunit/core/extension-point-test.xml (original)
+++ ant/core/branches/ANT_SITE/src/tests/antunit/core/extension-point-test.xml Mon Dec 13 18:34:00 2010
@@ -88,4 +88,49 @@
     <au:assertLogContains text="in target prepare"/>
   </target>
 
+  <target name="testMissingExtensionPointCausesError">
+    <mkdir dir="${output}"/>
+    <echo file="${output}/build.xml"><![CDATA[
+<project default="bar">
+  <target name="bar" extensionOf="foo"/>
+</project>]]></echo>
+    <au:expectfailure
+        expectedMessage="can't add target bar to extension-point foo because the extension-point is unknown">
+      <ant dir="${output}" target="bar"/>
+    </au:expectfailure>
+  </target>
+
+  <target name="testMissingExtensionPointCausesWarningWhenConfigured">
+    <mkdir dir="${output}"/>
+    <echo file="${output}/build.xml"><![CDATA[
+<project default="bar">
+  <target name="bar" extensionOf="foo" onMissingExtensionPoint="warn"/>
+</project>]]></echo>
+    <ant dir="${output}" target="bar"/>
+    <au:assertLogContains level="warning"
+        text="can't add target bar to extension-point foo because the extension-point is unknown" />
+  </target>
+
+  <target name="testMissingExtensionPointIgnoredWhenConfigured">
+    <mkdir dir="${output}"/>
+    <echo file="${output}/build.xml"><![CDATA[
+<project default="bar">
+  <target name="bar" extensionOf="foo" onMissingExtensionPoint="ignore"/>
+</project>]]></echo>
+    <ant dir="${output}" target="bar"/>
+    <au:assertLogDoesntContain level="warning"
+        text="can't add target bar to extension-point foo because the extension-point is unknown" />
+  </target>
+
+  <target name="testOnlyAllowsExtensionPointMissingAttributeWhenExtensionOfPresent">
+    <mkdir dir="${output}"/>
+    <echo file="${output}/build.xml"><![CDATA[
+<project default="bar">
+  <target name="bar" onMissingExtensionPoint="ignore"/>
+</project>]]></echo>
+    <au:expectfailure
+        expectedMessage="onMissingExtensionPoint attribute cannot be specified unless extensionOf is specified">
+      <ant dir="${output}" target="bar"/>
+    </au:expectfailure>
+  </target>
 </project>

Modified: ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/checksum-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/checksum-test.xml?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/checksum-test.xml (original)
+++ ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/checksum-test.xml Mon Dec 13 18:34:00 2010
@@ -36,12 +36,48 @@
           https://issues.apache.org/bugzilla/show_bug.cgi?id=36748">
     <mkdir dir="${input}"/>
     <echo file="${input}/a.txt">abc</echo>
+    <echo file="${input}/subdir/A.txt">def</echo>
     <echo file="${input}/B.txt">xyz</echo>
     <checksum totalproperty="total">
       <fileset dir="${input}"/>
     </checksum>
     <au:assertPropertyEquals name="total"
-                             value="709a9cf15c8834c59c7eeb07522cdf56"/>
+                             value="f4d688789d32e6ca6bc93c504dbc6b46"/>
+  </target>
+
+  <target name="testChecksumPattern2">
+    <mkdir dir="${output}"/>
+    <mkdir dir="${input}"/>
+    <echo file="${input}/a.txt">abc</echo>
+    <checksum todir="${output}" pattern="{2}">
+      <fileset dir="${input}"/>
+    </checksum>
+    <au:assertResourceContains
+        resource="${output}/a.txt.MD5"
+        value="../testinput/a.txt"/>
+  </target>
+
+  <target name="testChecksumPattern3">
+    <mkdir dir="${output}"/>
+    <checksum todir="${output}" pattern="{3}">
+      <fileset dir=".." includes="types/fileset-test.xml"/>
+    </checksum>
+    <au:assertResourceContains
+        resource="${output}/types/fileset-test.xml.MD5"
+        value="../types/fileset-test.xml"/>
+  </target>
+
+  <target name="testChecksumPattern4">
+    <mkdir dir="${output}"/>
+    <mkdir dir="${input}"/>
+    <property name="a" location="${input}/a.txt"/>
+    <echo file="${a}">abc</echo>
+    <checksum todir="${output}" pattern="{4}">
+      <fileset dir="${input}"/>
+    </checksum>
+    <au:assertResourceContains
+        resource="${output}/a.txt.MD5"
+        value="${a}"/>
   </target>
 
 </project>

Modified: ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/copy-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/copy-test.xml?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/copy-test.xml (original)
+++ ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/copy-test.xml Mon Dec 13 18:34:00 2010
@@ -295,4 +295,148 @@ public class NullByteStreamResource exte
     </copy>
   </target>
 
+  <!-- stolen from ../types/readwrite-test.xml - create a read-only file -->
+  <property name="file" value="testfile"/>
+  <condition property="unix">
+    <os family="unix"/>
+  </condition>
+  <target name="createTestdir">
+    <mkdir dir="${output}"/>
+    <mkdir dir="${input}"/>
+    <touch file="${output}/${file}"/>
+  </target>
+  <target name="makeFileUnwritable"
+          depends="createTestdir,makeFileUnwritable-Unix,makeFileUnwritable-Windows"/>
+  <target name="makeFileUnwritable-Unix" id="unix">
+    <chmod file="${output}/${file}" perm="444"/>
+  </target>
+  <target name="makeFileUnwritable-Windows" unless="unix">
+    <attrib file="${output}/${file}" readonly="true"/>
+  </target>
+
+  <target name="testCopyOverReadOnlyFile" depends="makeFileUnwritable">
+    <sleep seconds="2"/>
+    <touch file="${input}/${file}"/>
+    <au:expectfailure
+        expectedMessage="can't write to read-only destination file ">
+      <copy toDir="${output}">
+        <fileset dir="${input}"/>
+      </copy>
+    </au:expectfailure>
+  </target>
+
+  <target name="testFilteredCopyOverReadOnlyFile" depends="makeFileUnwritable">
+    <sleep seconds="2"/>
+    <touch file="${input}/${file}"/>
+    <au:expectfailure
+        expectedMessage="can't write to read-only destination file ">
+      <copy toDir="${output}">
+        <fileset dir="${input}"/>
+        <filterset>
+          <filter token="foo" value="bar"/>
+        </filterset>
+      </copy>
+    </au:expectfailure>
+  </target>
+
+  <target name="testCopyOverReadOnlyFileWithOverwrite"
+          depends="makeFileUnwritable">
+    <touch file="${input}/${file}"/>
+    <au:expectfailure
+        expectedMessage="can't write to read-only destination file ">
+      <copy toDir="${output}" overwrite="true">
+        <fileset dir="${input}"/>
+      </copy>
+    </au:expectfailure>
+  </target>
+
+  <target name="testFilteredCopyOverReadOnlyFileWithOverwrite"
+          depends="makeFileUnwritable">
+    <touch file="${input}/${file}"/>
+    <au:expectfailure
+        expectedMessage="can't write to read-only destination file ">
+      <copy toDir="${output}" overwrite="true">
+        <fileset dir="${input}"/>
+        <filterset>
+          <filter token="foo" value="bar"/>
+        </filterset>
+      </copy>
+    </au:expectfailure>
+  </target>
+
+  <target name="testForcedCopyOverReadOnlyFile" depends="makeFileUnwritable">
+    <sleep seconds="2"/>
+    <touch file="${input}/${file}"/>
+    <copy toDir="${output}" force="true">
+      <fileset dir="${input}"/>
+    </copy>
+  </target>
+
+  <target name="testForcedFilteredCopyOverReadOnlyFile"
+          depends="makeFileUnwritable">
+    <sleep seconds="2"/>
+    <touch file="${input}/${file}"/>
+    <copy toDir="${output}" force="true">
+      <fileset dir="${input}"/>
+      <filterset>
+        <filter token="foo" value="bar"/>
+      </filterset>
+    </copy>
+  </target>
+
+  <target name="testForcedCopyOverReadOnlyFileWithOverwrite"
+          depends="makeFileUnwritable">
+    <touch file="${input}/${file}"/>
+    <copy toDir="${output}" overwrite="true" force="true">
+      <fileset dir="${input}"/>
+    </copy>
+  </target>
+
+  <target name="testForcedFilteredCopyOverReadOnlyFileWithOverwrite"
+          depends="makeFileUnwritable">
+    <touch file="${input}/${file}"/>
+    <copy toDir="${output}" overwrite="true" force="true">
+      <fileset dir="${input}"/>
+      <filterset>
+        <filter token="foo" value="bar"/>
+      </filterset>
+    </copy>
+  </target>
+
+  <target name="testCopyWithResourceAndFile"
+          description="https://issues.apache.org/bugzilla/show_bug.cgi?id=49756"
+          >
+    <mkdir dir="${input}"/>
+    <au:assertFileDoesntExist file="${input}/somefile"/>
+    <copy tofile="${input}/somefile">
+      <first>
+        <union>
+          <restrict>
+            <exists/>
+            <fileset file="${input}/somefile"/>
+          </restrict>
+          <string value="default contents"/>
+        </union>
+      </first>
+    </copy>
+    <au:assertFileExists file="${input}/somefile"/>
+    <au:assertResourceContains resource="${input}/somefile"
+                               value="default contents"/>
+    <delete file="${input}/somefile"/>
+    <touch file="${input}/somefile"/>
+    <copy tofile="${input}/somefile">
+      <first>
+        <union>
+          <restrict>
+            <exists/>
+            <fileset file="${input}/somefile"/>
+          </restrict>
+          <string value="default contents"/>
+        </union>
+      </first>
+    </copy>
+    <au:assertFileExists file="${input}/somefile"/>
+    <au:assertResourceDoesntContain resource="${input}/somefile"
+                                    value="default contents"/>
+  </target>
 </project>

Modified: ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/delete-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/delete-test.xml?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/delete-test.xml (original)
+++ ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/delete-test.xml Mon Dec 13 18:34:00 2010
@@ -131,4 +131,11 @@
     </delete>
     <au:assertFileDoesntExist file="${input}/images/foo.jpg"/>
   </target>
+
+  <target name="testFilesetWithMissingButIgnoredDir"
+          description="https://issues.apache.org/bugzilla/show_bug.cgi?id=50124">
+    <delete>
+      <fileset dir="${input}/not-there" errorOnMissingDir="false"/>
+    </delete>
+  </target>
 </project>

Modified: ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/exec/apply-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/exec/apply-test.xml?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/exec/apply-test.xml (original)
+++ ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/exec/apply-test.xml Mon Dec 13 18:34:00 2010
@@ -756,4 +756,37 @@
     <au:assertLogContains text="${z}.bar,x out" />
   </target>
 
+  <target name="testRedirectorWithParallel" if="test.can.run" depends="xyz">
+    <apply executable="sh" dest="${input}" parallel="true" addsourcefile="yes">
+      <arg value="parrot.sh" />
+      <targetfile/>
+      <fileset refid="xyz" />
+      <globmapper from="*" to="*.bar"/>
+      <redirector output="${output}/all_out.txt" append="yes"/>
+    </apply>
+    <au:assertResourceContains resource="${output}/all_out.txt"
+                               value="x.bar out"/>
+    <au:assertResourceContains resource="${output}/all_out.txt"
+                               value="x.bar err"/>
+    <au:assertResourceContains resource="${output}/all_out.txt"
+                               value="x out"/>
+    <au:assertResourceContains resource="${output}/all_out.txt"
+                               value="x err"/>
+    <au:assertResourceContains resource="${output}/all_out.txt"
+                               value="y.bar out"/>
+    <au:assertResourceContains resource="${output}/all_out.txt"
+                               value="y.bar err"/>
+    <au:assertResourceContains resource="${output}/all_out.txt"
+                               value="y out"/>
+    <au:assertResourceContains resource="${output}/all_out.txt"
+                               value="y err"/>
+    <au:assertResourceContains resource="${output}/all_out.txt"
+                               value="z.bar out"/>
+    <au:assertResourceContains resource="${output}/all_out.txt"
+                               value="z.bar err"/>
+    <au:assertResourceContains resource="${output}/all_out.txt"
+                               value="z out"/>
+    <au:assertResourceContains resource="${output}/all_out.txt"
+                               value="z err"/>
+  </target>
 </project>

Propchange: ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/exec/expected/utf-8
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 13 18:34:00 2010
@@ -0,0 +1 @@
+/ant/core/trunk/src/tests/antunit/taskdefs/exec/expected/utf-8:939803-1045116

Propchange: ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/exec/input/iso8859-1
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 13 18:34:00 2010
@@ -0,0 +1 @@
+/ant/core/trunk/src/tests/antunit/taskdefs/exec/input/iso8859-1:939803-1045116

Modified: ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/hostinfo-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/hostinfo-test.xml?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/hostinfo-test.xml (original)
+++ ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/hostinfo-test.xml Mon Dec 13 18:34:00 2010
@@ -30,8 +30,11 @@
   <property name="apache-hostname" value="www.apache.org" />
   <property name="apache-domain" value="apache.org" />
   <property name="apache-realhost" value="eos" />
-  <property name="apache-ip4" value="140.211.11.130" />
+  <property name="apache-ip4" value="140.211.11.131" />
     
+  <property name="apache-realhost.gump" value="www" />
+  <property name="apache-domain.gump" value="apache.org" />
+
   <property name="xs4all-hostname" value="www.xs4all.nl" />
   <property name="xs4all-domain" value="xs4all.nl" />
   <property name="xs4all-realhost" value="www" />
@@ -47,15 +50,35 @@
 
     <target name="testApache" depends="setUp">
       <hostinfo prefix="apache" host="${apache-hostname}"/>
-      <au:assertEquals expected="${apache-realhost}" actual="${apache.NAME}"/>
-      <au:assertEquals expected="${apache-domain}" actual="${apache.DOMAIN}"/>
+      <au:assertTrue>
+        <or>
+          <equals arg1="${apache-realhost}" arg2="${apache.NAME}"/>
+          <equals arg1="${apache-realhost.gump}" arg2="${apache.NAME}"/>
+        </or>
+      </au:assertTrue>
+      <au:assertTrue>
+        <or>
+          <equals arg1="${apache-domain}" arg2="${apache.DOMAIN}"/>
+          <equals arg1="${apache-domain.gump}" arg2="${apache.DOMAIN}"/>
+        </or>
+      </au:assertTrue>
       <au:assertEquals expected="${apache-ip4}" actual="${apache.ADDR4}"/>
     </target>
 
     <target name="testApacheNoPrefix" depends="setUp">
       <hostinfo host="${apache-hostname}"/>
-      <au:assertEquals expected="${apache-realhost}" actual="${NAME}"/>
-      <au:assertEquals expected="${apache-domain}" actual="${DOMAIN}"/>
+      <au:assertTrue>
+        <or>
+          <equals arg1="${apache-realhost}" arg2="${NAME}"/>
+          <equals arg1="${apache-realhost.gump}" arg2="${NAME}"/>
+        </or>
+      </au:assertTrue>
+      <au:assertTrue>
+        <or>
+          <equals arg1="${apache-domain}" arg2="${DOMAIN}"/>
+          <equals arg1="${apache-domain.gump}" arg2="${DOMAIN}"/>
+        </or>
+      </au:assertTrue>
       <au:assertEquals expected="${apache-ip4}" actual="${ADDR4}"/>
     </target>
 

Modified: ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/jar-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/jar-test.xml?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/jar-test.xml (original)
+++ ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/jar-test.xml Mon Dec 13 18:34:00 2010
@@ -207,4 +207,23 @@
     <au:assertResourceContains value="Test: Header"
                                resource="${output}/META-INF/MANIFEST.MF"/>
   </target>
+
+  <target name="testZipfilesetMerge"
+          description="https://issues.apache.org/bugzilla/show_bug.cgi?id=49605">
+    <mkdir dir="${input}"/>
+    <mkdir dir="${output}"/>
+    <echo file="${input}/MANIFEST.MF">Manifest-Version: 1.0
+Main-Class: MyClass
+
+</echo>
+    <jar destfile="${input}/manifesttest.jar"
+         filesetmanifest="merge">
+      <zipfileset file="${input}/MANIFEST.MF" prefix="META-INF"/>
+    </jar>
+    <unjar src="${input}/manifesttest.jar" dest="${output}"/>
+    <au:assertFileExists file="${output}/META-INF/MANIFEST.MF"/>
+    <au:assertResourceContains value="Main-Class: MyClass"
+                               resource="${output}/META-INF/MANIFEST.MF"/>
+  </target>
+
 </project>

Modified: ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/move-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/move-test.xml?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/move-test.xml (original)
+++ ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/move-test.xml Mon Dec 13 18:34:00 2010
@@ -124,4 +124,111 @@
                                value="Y"/>
   </target>
 
+  <!-- stolen from ../types/readwrite-test.xml - create a read-only file -->
+  <property name="file" value="testfile"/>
+  <condition property="unix">
+    <os family="unix"/>
+  </condition>
+  <target name="createTestdir">
+    <mkdir dir="${output}"/>
+    <mkdir dir="${input}"/>
+    <touch file="${output}/${file}"/>
+  </target>
+  <target name="makeFileUnwritable"
+          depends="createTestdir,makeFileUnwritable-Unix,makeFileUnwritable-Windows"/>
+  <target name="makeFileUnwritable-Unix" id="unix">
+    <chmod file="${output}/${file}" perm="444"/>
+  </target>
+  <target name="makeFileUnwritable-Windows" unless="unix">
+    <attrib file="${output}/${file}" readonly="true"/>
+  </target>
+
+  <target name="testMoveOverReadOnlyFile" depends="makeFileUnwritable">
+    <sleep seconds="2"/>
+    <touch file="${input}/${file}"/>
+    <au:expectfailure
+        expectedMessage="can't replace read-only destination file ">
+      <move toDir="${output}">
+        <fileset dir="${input}"/>
+      </move>
+    </au:expectfailure>
+  </target>
+
+  <target name="testFilteredMoveOverReadOnlyFile" depends="makeFileUnwritable">
+    <sleep seconds="2"/>
+    <touch file="${input}/${file}"/>
+    <au:expectfailure
+        expectedMessage="can't write to read-only destination file ">
+      <move toDir="${output}">
+        <fileset dir="${input}"/>
+        <filterset>
+          <filter token="foo" value="bar"/>
+        </filterset>
+      </move>
+    </au:expectfailure>
+  </target>
+
+  <target name="testMoveOverReadOnlyFileWithOverwrite"
+          depends="makeFileUnwritable">
+    <touch file="${input}/${file}"/>
+    <au:expectfailure
+        expectedMessage="can't replace read-only destination file ">
+      <move toDir="${output}" overwrite="true">
+        <fileset dir="${input}"/>
+      </move>
+    </au:expectfailure>
+  </target>
+
+  <target name="testFilteredMoveOverReadOnlyFileWithOverwrite"
+          depends="makeFileUnwritable">
+    <touch file="${input}/${file}"/>
+    <au:expectfailure
+        expectedMessage="can't write to read-only destination file ">
+      <move toDir="${output}" overwrite="true">
+        <fileset dir="${input}"/>
+        <filterset>
+          <filter token="foo" value="bar"/>
+        </filterset>
+      </move>
+    </au:expectfailure>
+  </target>
+
+  <target name="testForcedMoveOverReadOnlyFile" depends="makeFileUnwritable">
+    <sleep seconds="2"/>
+    <touch file="${input}/${file}"/>
+    <move toDir="${output}" force="true">
+      <fileset dir="${input}"/>
+    </move>
+  </target>
+
+  <target name="testForcedFilteredMoveOverReadOnlyFile"
+          depends="makeFileUnwritable">
+    <sleep seconds="2"/>
+    <touch file="${input}/${file}"/>
+    <move toDir="${output}" force="true">
+      <fileset dir="${input}"/>
+      <filterset>
+        <filter token="foo" value="bar"/>
+      </filterset>
+    </move>
+  </target>
+
+  <target name="testForcedMoveOverReadOnlyFileWithOverwrite"
+          depends="makeFileUnwritable">
+    <touch file="${input}/${file}"/>
+    <move toDir="${output}" overwrite="true" force="true">
+      <fileset dir="${input}"/>
+    </move>
+  </target>
+
+  <target name="testForcedFilteredMoveOverReadOnlyFileWithOverwrite"
+          depends="makeFileUnwritable">
+    <touch file="${input}/${file}"/>
+    <move toDir="${output}" overwrite="true" force="true">
+      <fileset dir="${input}"/>
+      <filterset>
+        <filter token="foo" value="bar"/>
+      </filterset>
+    </move>
+  </target>
 </project>

Modified: ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/optional/junit/junit-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/optional/junit/junit-test.xml?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/optional/junit/junit-test.xml (original)
+++ ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/optional/junit/junit-test.xml Mon Dec 13 18:34:00 2010
@@ -24,9 +24,10 @@
 
   <macrodef name="empty-test">
     <attribute name="classname"/>
+    <attribute name="package" default="test"/>
     <sequential>
       <echo file="${input}/@{classname}.java"><![CDATA[
-package test;
+package @{package};
 import junit.framework.TestCase;
 
 public class @{classname} extends TestCase {
@@ -44,9 +45,9 @@ public class @{classname} extends TestCa
   <target name="testTimeoutLogOfBatchTests">
     <mkdir dir="${input}"/>
     <mkdir dir="${output}"/>
-    <empty-test classname="ATest"/>
+    <empty-test classname="ATest" package="org.apache.ant.test"/>
       <echo file="${input}/BTest.java"><![CDATA[
-package test;
+package org.apache.ant.test;
 import junit.framework.TestCase;
 
 public class BTest extends TestCase {
@@ -55,8 +56,8 @@ public class BTest extends TestCase {
     }
 }
 ]]>  </echo>
-    <empty-test classname="CTest"/>
-    <empty-test classname="DTest"/>
+    <empty-test classname="CTest" package="org.apache.ant.test"/>
+    <empty-test classname="DTest" package="org.apache.ant.test"/>
     <javac srcdir="${input}" destdir="${output}">
       <classpath refid="junit"/>
     </javac>
@@ -71,6 +72,7 @@ public class BTest extends TestCase {
     </junit>
     <au:assertLogContains text="ATest"/>
     <au:assertLogContains text="BTest"/>
+    <au:assertLogContains text="org.apache.ant.test.Batch-With-Multiple-Tests"/>
     <au:assertLogDoesntContain text="CTest"/>
     <au:assertLogDoesntContain text="DTest"/>
   </target>

Modified: ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/optional/junit/xmlformatter-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/optional/junit/xmlformatter-test.xml?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/optional/junit/xmlformatter-test.xml (original)
+++ ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/optional/junit/xmlformatter-test.xml Mon Dec 13 18:34:00 2010
@@ -50,4 +50,41 @@ public class A extends TestCase {
     <xmlvalidate file="${output}/TEST-org.example.A.xml"
                  lenient="true"/>
   </target>
+
+  <target name="testEntities"
+          description="https://issues.apache.org/bugzilla/show_bug.cgi?id=49404">
+    <mkdir dir="${input}/org/example"/>
+    <echo file="${input}/org/example/A.java"><![CDATA[
+package org.example;
+import junit.framework.TestCase;
+public class A extends TestCase {
+    public void testX() {
+       assertTrue("&amp;&", false);
+    }
+}
+]]></echo>
+    <mkdir dir="${output}"/>
+    <javac srcdir="${input}" destdir="${output}">
+      <classpath refid="junit"/>
+    </javac>
+    <junit fork="true">
+      <classpath refid="junit"/>
+      <classpath location="${output}"/>
+      <batchtest todir="${output}">
+        <fileset dir="${output}">
+          <include name="**/A.class" />
+        </fileset>
+      </batchtest>
+      <formatter type="xml"/>
+    </junit>
+    <xmlvalidate file="${output}/TEST-org.example.A.xml"
+                 lenient="true"/>
+    <au:assertResourceContains
+        resource="${output}/TEST-org.example.A.xml"
+        value="message=&quot;&amp;amp;amp;&amp;amp;"/>
+    <au:assertResourceContains
+        resource="${output}/TEST-org.example.A.xml"
+        value="AssertionFailedError: &amp;amp;amp;&amp;"/>
+  </target>
+
 </project>

Modified: ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/optional/propertyfilelayout-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/optional/propertyfilelayout-test.xml?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/optional/propertyfilelayout-test.xml (original)
+++ ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/optional/propertyfilelayout-test.xml Mon Dec 13 18:34:00 2010
@@ -241,4 +241,49 @@ x=1
     <au:assertPropertyEquals name="tail.out" value="${tail.in}"/>
   </target>
 
+
+  <target name="testPreservesDosLineEnds" depends="setUp"
+          description="https://issues.apache.org/bugzilla/show_bug.cgi?id=50049">
+    <property name="test.txt" location="${output}/test.txt"/>
+    <echo file="${test.txt}"><![CDATA[
+bbb=val2
+aaa=val1
+]]></echo>
+    <fixcrlf eol="dos" file="${test.txt}"/>
+    <propertyfile file="${test.txt}" comment="${header}"/>
+    <copy file="${test.txt}" tofile="${test.txt}.expected"/>
+    <fixcrlf eol="dos" file="${test.txt}.expected"/>
+    <au:assertFilesMatch expected="${test.txt}.expected"
+                         actual="${test.txt}"/>
+  </target>
+
+  <target name="testPreservesUnixLineEnds" depends="setUp"
+          description="https://issues.apache.org/bugzilla/show_bug.cgi?id=50049">
+    <property name="test.txt" location="${output}/test.txt"/>
+    <echo file="${test.txt}"><![CDATA[
+bbb=val2
+aaa=val1
+]]></echo>
+    <fixcrlf eol="unix" file="${test.txt}"/>
+    <propertyfile file="${test.txt}" comment="${header}"/>
+    <copy file="${test.txt}" tofile="${test.txt}.expected"/>
+    <fixcrlf eol="unix" file="${test.txt}.expected"/>
+    <au:assertFilesMatch expected="${test.txt}.expected"
+                         actual="${test.txt}"/>
+  </target>
+
+  <target name="testPreservesMacLineEnds" depends="setUp"
+          description="https://issues.apache.org/bugzilla/show_bug.cgi?id=50049">
+    <property name="test.txt" location="${output}/test.txt"/>
+    <echo file="${test.txt}"><![CDATA[
+bbb=val2
+aaa=val1
+]]></echo>
+    <fixcrlf eol="mac" file="${test.txt}"/>
+    <propertyfile file="${test.txt}" comment="${header}"/>
+    <copy file="${test.txt}" tofile="${test.txt}.expected"/>
+    <fixcrlf eol="mac" file="${test.txt}.expected"/>
+    <au:assertFilesMatch expected="${test.txt}.expected"
+                         actual="${test.txt}"/>
+  </target>
 </project>

Modified: ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/property-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/property-test.xml?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/property-test.xml (original)
+++ ant/core/branches/ANT_SITE/src/tests/antunit/taskdefs/property-test.xml Mon Dec 13 18:34:00 2010
@@ -87,5 +87,50 @@ y=$${x}
 ]]></echo>
     <property file="${input}/x.properties"/>
     <au:assertPropertyEquals name="y" value="x"/>
+    <echo file="${input}/y.properties"><![CDATA[
+x=y
+y=$${x}
+]]></echo>
+    <property file="${input}/y.properties" prefix="foo"/>
+    <!-- passes in Ant 1.8.0 and 1.7.1, fails in 1.8.1 -->
+    <au:assertPropertyEquals name="foo.y" value="x"/>
+    <echo file="${input}/z.properties"><![CDATA[
+x=y
+y=$${bar.x}
+]]></echo>
+    <property file="${input}/z.properties" prefix="bar"/>
+    <!-- passes in Ant 1.7.1 and 1.8.1, fails in 1.8.0 -->
+    <au:assertPropertyEquals name="bar.y" value="y"/>
+  </target>
+
+  <!-- passes in Ant 1.7.1 and 1.8.1, fails in 1.8.0 -->
+  <target name="testMultiplePrefixes"
+          description="https://issues.apache.org/bugzilla/show_bug.cgi?id=48768">
+    <mkdir dir="${input}"/>
+    <echo file="${input}/x.properties"><![CDATA[
+x=1
+y=2
+]]></echo>
+    <property file="${input}/x.properties"/>
+    <au:assertPropertyEquals name="x" value="1"/>
+    <au:assertPropertyEquals name="y" value="2"/>
+    <echo file="${input}/y.properties"><![CDATA[
+x=3
+]]></echo>
+    <property file="${input}/y.properties" prefix="foo"/>
+    <au:assertPropertyEquals name="foo.x" value="3"/>
+  </target>
+
+  <!-- passes in Ant 1.7.1 and 1.8.0, fails in 1.8.1 -->
+  <target name="testNestedExpansionDoesntUsePrefix"
+          description="https://issues.apache.org/bugzilla/show_bug.cgi?id=49373">
+    <mkdir dir="${input}"/>
+    <property name="x" value="x"/>
+    <echo file="${input}/x.properties"><![CDATA[
+x=y
+y=$${x}
+]]></echo>
+    <property file="${input}/x.properties" prefix="foo"/>
+    <au:assertPropertyEquals name="foo.y" value="x"/>
   </target>
 </project>