ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r1045279 [8/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/ docs...
Date Mon, 13 Dec 2010 18:34:09 GMT
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Checksum.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Checksum.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Checksum.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Checksum.java Mon Dec 13 18:34:00 2010
@@ -61,6 +61,7 @@ import org.apache.tools.ant.util.StringU
  */
 public class Checksum extends MatchingTask implements Condition {
 
+    private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
     private static final int NIBBLE = 4;
     private static final int WORD = 16;
     private static final int BUFFER_SIZE = 8 * 1024;
@@ -457,15 +458,7 @@ public class Checksum extends MatchingTa
         File directory;
         if (todir != null) {
             // A separate directory was explicitly declared
-            String path = (String) relativeFilePaths.get(file);
-            if (path == null) {
-                //bug 37386. this should not occur, but it has, once.
-                throw new BuildException(
-                    "Internal error: "
-                    + "relativeFilePaths could not match file"
-                    + file + "\n"
-                    + "please file a bug report on this");
-            }
+            String path = getRelativeFilePath(file);
             directory = new File(todir, path).getParentFile();
             // Create the directory, as it might not exist.
             directory.mkdirs();
@@ -539,6 +532,15 @@ public class Checksum extends MatchingTa
                         fos.write(format.format(new Object[] {
                                                     checksum,
                                                     src.getName(),
+                                                    FileUtils
+                                                    .getRelativePath(dest
+                                                                     .getParentFile(),
+                                                                     src),
+                                                    FileUtils
+                                                    .getRelativePath(getProject()
+                                                                     .getBaseDir(),
+                                                                     src),
+                                                    src.getAbsolutePath()
                                                 }).getBytes());
                         fos.write(StringUtils.LINE_SEP.getBytes());
                         fos.close();
@@ -559,8 +561,8 @@ public class Checksum extends MatchingTa
                             File f2 = (File) o2;
                             return f1 == null ? (f2 == null ? 0 : -1)
                                 : (f2 == null ? 1
-                                   : f1.getName().compareTo(f2.getName())
-                                   );
+                                   : getRelativeFilePath(f1)
+                                   .compareTo(getRelativeFilePath(f2)));
                         }
                     });
                 // Loop over the checksums and generate a total hash.
@@ -573,7 +575,7 @@ public class Checksum extends MatchingTa
                     messageDigest.update(digest);
 
                     // Add the file path
-                    String fileName = (String) relativeFilePaths.get(src);
+                    String fileName = getRelativeFilePath(src);
                     messageDigest.update(fileName.getBytes());
                 }
                 String totalChecksum = createDigestString(messageDigest.digest());
@@ -655,6 +657,21 @@ public class Checksum extends MatchingTa
     }
 
     /**
+     * @since Ant 1.8.2
+     */
+    private String getRelativeFilePath(File f) {
+        String path = (String) relativeFilePaths.get(f);
+        if (path == null) {
+            //bug 37386. this should not occur, but it has, once.
+            throw new BuildException("Internal error: "
+                                     + "relativeFilePaths could not match file "
+                                     + f + "\n"
+                                     + "please file a bug report on this");
+        }
+        return path;
+    }
+
+    /**
      * Helper class for the format attribute.
      *
      * @since 1.7

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Concat.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Concat.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Concat.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Concat.java Mon Dec 13 18:34:00 2010
@@ -471,6 +471,8 @@ public class Concat extends Task impleme
     private Vector filterChains;
     /** ignore dates on input files */
     private boolean forceOverwrite = true;
+    /** overwrite read-only files */
+    private boolean force = false;
     /** String to place at the start of the concatented stream */
     private TextElement footer;
     /** String to place at the end of the concatented stream */
@@ -526,6 +528,7 @@ public class Concat extends Task impleme
         eolString = StringUtils.LINE_SEP;
         rc = null;
         ignoreEmpty = true;
+        force = false;
     }
 
     // Attribute setters.
@@ -581,12 +584,36 @@ public class Concat extends Task impleme
 
     /**
      * Force overwrite existing destination file
-     * @param force if true always overwrite, otherwise only overwrite
-     *              if the output file is older any of the input files.
+     * @param forceOverwrite if true always overwrite, otherwise only
+     *              overwrite if the output file is older any of the
+     *              input files.
      * @since Ant 1.6
+     * @deprecated use #setOverwrite instead
      */
-    public void setForce(boolean force) {
-        this.forceOverwrite = force;
+    public void setForce(boolean forceOverwrite) {
+        this.forceOverwrite = forceOverwrite;
+    }
+
+    /**
+     * Force overwrite existing destination file
+     * @param forceOverwrite if true always overwrite, otherwise only
+     *              overwrite if the output file is older any of the
+     *              input files.
+     * @since Ant 1.8.2
+     */
+    public void setOverwrite(boolean forceOverwrite) {
+        setForce(forceOverwrite);
+    }
+
+    /**
+     * Whether read-only destinations will be overwritten.
+     *
+     * <p>Defaults to false</p>
+     *
+     * @since Ant 1.8.2
+     */
+    public void setForceReadOnly(boolean f) {
+        force = f;
     }
 
     /**
@@ -761,9 +788,11 @@ public class Concat extends Task impleme
         }
         try {
             //most of these are defaulted because the concat-as-a-resource code hijacks a lot:
-            ResourceUtils.copyResource(new ConcatResource(c), dest == null ? new LogOutputResource(
-                    this, Project.MSG_WARN) : dest, null, null, true, false, append, null, null,
-                    getProject());
+            ResourceUtils.copyResource(new ConcatResource(c), dest == null
+                                       ? new LogOutputResource(this, Project.MSG_WARN)
+                                       : dest,
+                                       null, null, true, false, append, null,
+                                       null, getProject(), force);
         } catch (IOException e) {
             throw new BuildException("error concatenating content to " + dest, e);
         }

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Copy.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Copy.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Copy.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Copy.java Mon Dec 13 18:34:00 2010
@@ -46,6 +46,7 @@ import org.apache.tools.ant.types.resour
 import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.util.FileNameMapper;
 import org.apache.tools.ant.util.IdentityMapper;
+import org.apache.tools.ant.util.LinkedHashtable;
 import org.apache.tools.ant.util.ResourceUtils;
 import org.apache.tools.ant.util.SourceFileScanner;
 import org.apache.tools.ant.util.FlatFileNameMapper;
@@ -88,9 +89,9 @@ public class Copy extends Task {
     protected boolean includeEmpty = true;
     protected boolean failonerror = true;
 
-    protected Hashtable fileCopyMap = new Hashtable();
-    protected Hashtable dirCopyMap = new Hashtable();
-    protected Hashtable completeDirMap = new Hashtable();
+    protected Hashtable fileCopyMap = new LinkedHashtable();
+    protected Hashtable dirCopyMap = new LinkedHashtable();
+    protected Hashtable completeDirMap = new LinkedHashtable();
 
     protected Mapper mapperElement = null;
     protected FileUtils fileUtils;
@@ -100,6 +101,11 @@ public class Copy extends Task {
     private String inputEncoding = null;
     private String outputEncoding = null;
     private long granularity = 0;
+    private boolean force = false;
+
+    // used to store the single non-file resource to copy when the
+    // tofile attribute has been used
+    private Resource singleResource = null;
 
     /**
      * Copy task constructor.
@@ -229,6 +235,26 @@ public class Copy extends Task {
     }
 
     /**
+     * Whether read-only destinations will be overwritten.
+     *
+     * <p>Defaults to false</p>
+     *
+     * @since Ant 1.8.2
+     */
+    public void setForce(boolean f) {
+        force = f;
+    }
+
+    /**
+     * Whether read-only destinations will be overwritten.
+     *
+     * @since Ant 1.8.2
+     */
+    public boolean getForce() {
+        return force;
+    }
+
+    /**
      * Set whether files copied from directory trees will be "flattened"
      * into a single directory.  If there are multiple files with
      * the same name in the source directory tree, only the first
@@ -529,11 +555,15 @@ public class Copy extends Task {
                 }
             }
 
-            if (nonFileResources.size() > 0) {
+            if (nonFileResources.size() > 0 || singleResource != null) {
                 Resource[] nonFiles =
                     (Resource[]) nonFileResources.toArray(new Resource[nonFileResources.size()]);
                 // restrict to out-of-date resources
                 Map map = scan(nonFiles, destDir);
+                if (singleResource != null) {
+                    map.put(singleResource,
+                            new String[] { destFile.getAbsolutePath() });
+                }
                 try {
                     doResourceOperations(map);
                 } catch (BuildException e) {
@@ -547,6 +577,7 @@ public class Copy extends Task {
         } finally {
             // clean up again, so this instance can be used a second
             // time
+            singleResource = null;
             file = savedFile;
             destFile = savedDestFile;
             destDir = savedDestDir;
@@ -640,10 +671,9 @@ public class Copy extends Task {
                     "Cannot concatenate multiple files into a single file.");
             } else {
                 ResourceCollection rc = (ResourceCollection) rcs.elementAt(0);
-                if (!rc.isFilesystemOnly()) {
+                if (!rc.isFilesystemOnly() && !supportsNonFileResources()) {
                     throw new BuildException("Only FileSystem resources are"
-                                             + " supported when concatenating"
-                                             + " files.");
+                                             + " supported.");
                 }
                 if (rc.size() == 0) {
                     throw new BuildException(MSG_WHEN_COPYING_EMPTY_RC_TO_FILE);
@@ -651,7 +681,11 @@ public class Copy extends Task {
                     Resource res = (Resource) rc.iterator().next();
                     FileProvider r = (FileProvider) res.as(FileProvider.class);
                     if (file == null) {
-                        file = r.getFile();
+                        if (r != null) {
+                            file = r.getFile();
+                        } else {
+                            singleResource = res;
+                        }
                         rcs.removeElementAt(0);
                     } else {
                         throw new BuildException(
@@ -838,10 +872,13 @@ public class Copy extends Task {
                             executionFilters
                                 .addFilterSet((FilterSet) filterEnum.nextElement());
                         }
-                        fileUtils.copyFile(fromFile, toFile, executionFilters,
+                        fileUtils.copyFile(new File(fromFile), new File(toFile),
+                                           executionFilters,
                                            filterChains, forceOverwrite,
-                                           preserveLastModified, inputEncoding,
-                                           outputEncoding, getProject());
+                                           preserveLastModified,
+                                           /* append: */ false, inputEncoding,
+                                           outputEncoding, getProject(),
+                                           getForce());
                     } catch (IOException ioe) {
                         String msg = "Failed to copy " + fromFile + " to " + toFile
                             + " due to " + getDueTo(ioe);
@@ -928,9 +965,11 @@ public class Copy extends Task {
                                                    filterChains,
                                                    forceOverwrite,
                                                    preserveLastModified,
+                                                   /* append: */ false,
                                                    inputEncoding,
                                                    outputEncoding,
-                                                   getProject());
+                                                   getProject(),
+                                                   getForce());
                     } catch (IOException ioe) {
                         String msg = "Failed to copy " + fromResource
                             + " to " + toFile

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Delete.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Delete.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Delete.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Delete.java Mon Dec 13 18:34:00 2010
@@ -27,7 +27,6 @@ import java.util.Comparator;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.taskdefs.condition.Os;
 import org.apache.tools.ant.types.FileSet;
 import org.apache.tools.ant.types.PatternSet;
 import org.apache.tools.ant.types.Resource;
@@ -603,6 +602,10 @@ public class Delete extends MatchingTask
                 fs.setProject(getProject());
             }
             final File fsDir = fs.getDir();
+            if (!fs.getErrorOnMissingDir() &&
+                (fsDir == null || !fsDir.exists())) {
+                continue;
+            }
             if (fsDir == null) {
                 throw new BuildException(
                         "File or Resource without directory or file specified");

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Echo.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Echo.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Echo.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Echo.java Mon Dec 13 18:34:00 2010
@@ -47,6 +47,7 @@ public class Echo extends Task {
     protected boolean append = false;
     /** encoding; set to null or empty means 'default' */
     private String encoding = "";
+    private boolean force = false;
 
     // by default, messages are always displayed
     protected int logLevel = Project.MSG_WARN;
@@ -63,9 +64,12 @@ public class Echo extends Task {
         final String msg = "".equals(message) ? StringUtils.LINE_SEP : message;
         try {
             ResourceUtils
-                    .copyResource(new StringResource(msg), output == null ? new LogOutputResource(
-                            this, logLevel) : output, null, null, false, false, append, null, ""
-                            .equals(encoding) ? null : encoding, getProject());
+                    .copyResource(new StringResource(msg), output == null
+                                  ? new LogOutputResource(this, logLevel)
+                                  : output,
+                                  null, null, false, false, append, null,
+                                  "".equals(encoding) ? null : encoding,
+                                  getProject(), force);
         } catch (IOException ioe) {
             throw new BuildException(ioe, getLocation());
         }
@@ -148,6 +152,17 @@ public class Echo extends Task {
     }
 
     /**
+     * Whether read-only destinations will be overwritten.
+     *
+     * <p>Defaults to false</p>
+     *
+     * @since Ant 1.8.2
+     */
+    public void setForce(boolean f) {
+        force = f;
+    }
+
+    /**
      * The enumerated values for the level attribute.
      */
     public static class EchoLevel extends LogLevel {

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/ExecTask.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/ExecTask.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/ExecTask.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/ExecTask.java Mon Dec 13 18:34:00 2010
@@ -21,8 +21,9 @@ package org.apache.tools.ant.taskdefs;
 import java.io.File;
 import java.io.IOException;
 import java.util.Enumeration;
-import java.util.Vector;
 import java.util.Locale;
+import java.util.Map;
+import java.util.Vector;
 
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
@@ -454,14 +455,9 @@ public class ExecTask extends Task {
                 }
             }
             if (p == null) {
-                Vector envVars = Execute.getProcEnvironment();
-                Enumeration e = envVars.elements();
-                while (e.hasMoreElements()) {
-                    String line = (String) e.nextElement();
-                    if (isPath(line)) {
-                        p = new Path(getProject(), getPath(line));
-                        break;
-                    }
+                String path = getPath(Execute.getEnvironmentVariables());
+                if (path != null) {
+                    p = new Path(getProject(), path);
                 }
             }
             if (p != null) {
@@ -724,4 +720,9 @@ public class ExecTask extends Task {
     private String getPath(String line) {
         return line.substring("PATH=".length());
     }
+
+    private String getPath(Map/*<String, String>*/ map) {
+        String p = (String) map.get("PATH");
+        return p != null ? p : (String) map.get("Path");
+    }
 }

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Execute.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Execute.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Execute.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Execute.java Mon Dec 13 18:34:00 2010
@@ -26,8 +26,11 @@ import java.io.FileWriter;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.StringReader;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
 import java.util.Vector;
 
 import org.apache.tools.ant.BuildException;
@@ -37,6 +40,7 @@ import org.apache.tools.ant.Task;
 import org.apache.tools.ant.taskdefs.condition.Os;
 import org.apache.tools.ant.types.Commandline;
 import org.apache.tools.ant.util.FileUtils;
+import org.apache.tools.ant.util.JavaEnvUtils;
 import org.apache.tools.ant.util.StringUtils;
 
 /**
@@ -71,7 +75,7 @@ public class Execute {
     private static String antWorkingDirectory = System.getProperty("user.dir");
     private static CommandLauncher vmLauncher = null;
     private static CommandLauncher shellLauncher = null;
-    private static Vector procEnvironment = null;
+    private static Map/*<String, String>*/ procEnvironment = null;
 
     /** Used to destroy processes when the VM exits. */
     private static ProcessDestroyer processDestroyer = new ProcessDestroyer();
@@ -148,14 +152,26 @@ public class Execute {
     /**
      * Find the list of environment variables for this process.
      *
-     * @return a vector containing the environment variables.
-     * The vector elements are strings formatted like variable = value.
+     * @return a map containing the environment variables.
+     * @since Ant 1.8.2
      */
-    public static synchronized Vector getProcEnvironment() {
+    public static synchronized Map/*<String,String>*/ getEnvironmentVariables() {
         if (procEnvironment != null) {
             return procEnvironment;
         }
-        procEnvironment = new Vector();
+        if (JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_1_5)
+            && !Os.isFamily("openvms")) {
+            try {
+                procEnvironment = (Map) System.class
+                    .getMethod("getenv", new Class[0])
+                    .invoke(null, new Object[0]);
+                return procEnvironment;
+            } catch (Exception x) {
+                x.printStackTrace();
+            }
+        }
+
+        procEnvironment = new LinkedHashMap();
         try {
             ByteArrayOutputStream out = new ByteArrayOutputStream();
             Execute exe = new Execute(new PumpStreamHandler(out));
@@ -170,7 +186,7 @@ public class Execute {
                 new BufferedReader(new StringReader(toString(out)));
 
             if (Os.isFamily("openvms")) {
-                procEnvironment = addVMSLogicals(procEnvironment, in);
+                procEnvironment = getVMSLogicals(in);
                 return procEnvironment;
             }
             String var = null;
@@ -187,14 +203,17 @@ public class Execute {
                 } else {
                     // New env var...append the previous one if we have it.
                     if (var != null) {
-                        procEnvironment.addElement(var);
+                        int eq = var.indexOf("=");
+                        procEnvironment.put(var.substring(0, eq),
+                                            var.substring(eq + 1));
                     }
                     var = line;
                 }
             }
             // Since we "look ahead" before adding, there's one last env var.
             if (var != null) {
-                procEnvironment.addElement(var);
+                int eq = var.indexOf("=");
+                procEnvironment.put(var.substring(0, eq), var.substring(eq + 1));
             }
         } catch (java.io.IOException exc) {
             exc.printStackTrace();
@@ -204,6 +223,23 @@ public class Execute {
     }
 
     /**
+     * Find the list of environment variables for this process.
+     *
+     * @return a vector containing the environment variables.
+     * The vector elements are strings formatted like variable = value.
+     * @deprecated use #getEnvironmentVariables instead
+     */
+    public static synchronized Vector getProcEnvironment() {
+        Vector v = new Vector();
+        Iterator it = getEnvironmentVariables().entrySet().iterator();
+        while (it.hasNext()) {
+            Map.Entry entry = (Map.Entry) it.next();
+            v.add(entry.getKey() + "=" + entry.getValue());
+        }
+        return v;
+    }
+
+    /**
      * This is the operation to get our environment.
      * It is a notorious troublespot pre-Java1.5, and should be approached
      * with extreme caution.
@@ -624,36 +660,39 @@ public class Execute {
         if (Os.isFamily("openvms")) {
             return env;
         }
-        Vector osEnv = (Vector) getProcEnvironment().clone();
+        Map/*<String, String>*/ osEnv =
+            new LinkedHashMap(getEnvironmentVariables());
         for (int i = 0; i < env.length; i++) {
             String keyValue = env[i];
-            // Get key including "="
-            String key = keyValue.substring(0, keyValue.indexOf('=') + 1);
-            if (environmentCaseInSensitive) {
-                // Nb: using default locale as key is a env name
-                key = key.toLowerCase();
-            }
-            int size = osEnv.size();
+            String key = keyValue.substring(0, keyValue.indexOf('='));
             // Find the key in the current enviroment copy
             // and remove it.
-            for (int j = 0; j < size; j++) {
-                String osEnvItem = (String) osEnv.elementAt(j);
-                String convertedItem = environmentCaseInSensitive
-                    ? osEnvItem.toLowerCase() : osEnvItem;
-                if (convertedItem.startsWith(key)) {
-                    osEnv.removeElementAt(j);
-                    if (environmentCaseInSensitive) {
+
+            // Try without changing case first
+            if (osEnv.remove(key) == null && environmentCaseInSensitive) {
+                // not found, maybe perform a case insensitive search
+
+                for (Iterator it = osEnv.keySet().iterator(); it.hasNext(); ) {
+                    String osEnvItem = (String) it.next();
+                    // Nb: using default locale as key is a env name
+                    if (osEnvItem.toLowerCase().equals(key.toLowerCase())) {
                         // Use the original casiness of the key
-                        keyValue = osEnvItem.substring(0, key.length())
-                            + keyValue.substring(key.length());
+                        key = osEnvItem;
+                        break;
                     }
-                    break;
                 }
             }
+
             // Add the key to the enviromnent copy
-            osEnv.addElement(keyValue);
+            osEnv.put(key, keyValue.substring(key.length() + 1));
         }
-        return (String[]) (osEnv.toArray(new String[osEnv.size()]));
+
+        ArrayList l = new ArrayList();
+        for (Iterator it = osEnv.entrySet().iterator(); it.hasNext(); ) {
+            Map.Entry entry = (Map.Entry) it.next();
+            l.add(entry.getKey() + "=" + entry.getValue());
+        }
+        return (String[]) (l.toArray(new String[osEnv.size()]));
     }
 
     /**
@@ -696,17 +735,17 @@ public class Execute {
     }
 
     /**
-     * This method is VMS specific and used by getProcEnvironment().
+     * This method is VMS specific and used by getEnvironmentVariables().
      *
-     * Parses VMS logicals from <code>in</code> and adds them to
-     * <code>environment</code>.  <code>in</code> is expected to be the
+     * Parses VMS logicals from <code>in</code> and returns them as a Map.
+     * <code>in</code> is expected to be the
      * output of "SHOW LOGICAL".  The method takes care of parsing the output
      * correctly as well as making sure that a logical defined in multiple
      * tables only gets added from the highest order table.  Logicals with
      * multiple equivalence names are mapped to a variable with multiple
      * values separated by a comma (,).
      */
-    private static Vector addVMSLogicals(Vector environment, BufferedReader in)
+    private static Map getVMSLogicals(BufferedReader in)
         throws IOException {
         HashMap logicals = new HashMap();
         String logName = null, logValue = null, newLogName;
@@ -740,11 +779,7 @@ public class Execute {
         if (logName != null) {
             logicals.put(logName, logValue);
         }
-        for (Iterator i = logicals.keySet().iterator(); i.hasNext();) {
-            String logical = (String) i.next();
-            environment.add(logical + "=" + logicals.get(logical));
-        }
-        return environment;
+        return logicals;
     }
 
     /**

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java Mon Dec 13 18:34:00 2010
@@ -708,6 +708,11 @@ public class ExecuteOn extends ExecTask 
             String[] command = getCommandline(s, b);
             log(Commandline.describeCommand(command), Project.MSG_VERBOSE);
             exe.setCommandline(command);
+            if (redirectorElement != null) {
+                setupRedirector();
+                redirectorElement.configure(redirector, null);
+                exe.setStreamHandler(redirector.createHandler());
+            }
             runExecute(exe);
         } else {
             int stillToDo = fileNames.size();

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Get.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Get.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Get.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Get.java Mon Dec 13 18:34:00 2010
@@ -29,9 +29,7 @@ import java.net.HttpURLConnection;
 import java.net.URL;
 import java.net.URLConnection;
 import java.util.Date;
-import java.util.HashSet;
 import java.util.Iterator;
-import java.util.Set;
 
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/HostInfo.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/HostInfo.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/HostInfo.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/HostInfo.java Mon Dec 13 18:34:00 2010
@@ -129,7 +129,7 @@ public class HostInfo extends Task {
             }
             selectAddresses();
 
-            if (nameAddr != null) {
+            if (nameAddr != null && hasHostName(nameAddr)) {
                 setDomainAndName(nameAddr.getCanonicalHostName());
             } else {
                 setProperty(DOMAIN, DEF_DOMAIN);
@@ -153,6 +153,11 @@ public class HostInfo extends Task {
             setProperty(ADDR6, DEF_LOCAL_ADDR6);
         }
     }
+    
+    private boolean hasHostName(InetAddress addr)
+    {   
+        return !addr.getHostAddress().equals(addr.getCanonicalHostName());
+    }
 
     private void selectAddresses() {
         Iterator i = inetAddrs.iterator();
@@ -167,7 +172,7 @@ public class HostInfo extends Task {
             }
         }
         
-        nameAddr = selectBestAddress(best6, best4);
+        nameAddr = selectBestAddress(best4, best6);
     }
 
     private InetAddress selectBestAddress(InetAddress bestSoFar,
@@ -177,7 +182,7 @@ public class HostInfo extends Task {
             // none selected so far, so this one is better.
             best = current;
         } else {
-            if (current.isLoopbackAddress()) {
+            if (current == null || current.isLoopbackAddress()) {
                 // definitely not better than the previously selected address.
             } else if (current.isLinkLocalAddress()) {
                 // link local considered better than loopback
@@ -186,13 +191,24 @@ public class HostInfo extends Task {
                 }
             } else if (current.isSiteLocalAddress()) {
                 // site local considered better than link local (and loopback)
-                if (best.isLoopbackAddress() || best.isLinkLocalAddress()) {
+                // address with hostname resolved considered better than
+                // address without hostname
+                if (best.isLoopbackAddress()
+                        || best.isLinkLocalAddress()
+                        || (best.isSiteLocalAddress() && !hasHostName(best))) {
                     best = current;
                 }
             } else {
-                // current is a global address, and therefore best (at least
-                // equally well)
-                best = current;
+                // current is a "Global address", considered better than 
+                // site local (and better than link local, loopback)
+                // address with hostname resolved considered better than
+                // address without hostname
+                if (best.isLoopbackAddress()
+                        || best.isLinkLocalAddress()
+                        || best.isSiteLocalAddress()
+                        || !hasHostName(best)) {
+                    best = current;
+                }
             }
         }
         return best;
@@ -204,7 +220,7 @@ public class HostInfo extends Task {
 
             selectAddresses();
 
-            if (nameAddr != null) {
+            if (nameAddr != null && hasHostName(nameAddr)) {
                 setDomainAndName(nameAddr.getCanonicalHostName());
             } else {
                 setDomainAndName(host);

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/ImportTask.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/ImportTask.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/ImportTask.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/ImportTask.java Mon Dec 13 18:34:00 2010
@@ -21,6 +21,7 @@ package org.apache.tools.ant.taskdefs;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.ProjectHelper;
 import org.apache.tools.ant.Project;
+import org.apache.tools.ant.ProjectHelperRepository;
 import org.apache.tools.ant.Task;
 import org.apache.tools.ant.types.Resource;
 import org.apache.tools.ant.types.ResourceCollection;
@@ -213,7 +214,22 @@ public class ImportTask extends Task {
             setProjectHelperProps(prefix, prefixSeparator,
                                   isInIncludeMode());
 
-            helper.parse(getProject(), importedResource);
+            ProjectHelper subHelper = ProjectHelperRepository.getInstance().getProjectHelperForBuildFile(
+                    importedResource);
+
+            // push current stacks into the sub helper
+            subHelper.getImportStack().addAll(helper.getImportStack());
+            subHelper.getExtensionStack().addAll(helper.getExtensionStack());
+            getProject().addReference(ProjectHelper.PROJECTHELPER_REFERENCE, subHelper);
+
+            subHelper.parse(getProject(), importedResource);
+
+            // push back the stack from the sub helper to the main one
+            getProject().addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper);
+            helper.getImportStack().clear();
+            helper.getImportStack().addAll(subHelper.getImportStack());
+            helper.getExtensionStack().clear();
+            helper.getExtensionStack().addAll(subHelper.getExtensionStack());
         } catch (BuildException ex) {
             throw ProjectHelper.addLocationToBuildException(
                 ex, getLocation());

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Jar.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Jar.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Jar.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Jar.java Mon Dec 13 18:34:00 2010
@@ -46,6 +46,7 @@ import java.util.zip.ZipFile;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.taskdefs.Manifest.Section;
+import org.apache.tools.ant.types.ArchiveFileSet;
 import org.apache.tools.ant.types.EnumeratedAttribute;
 import org.apache.tools.ant.types.FileSet;
 import org.apache.tools.ant.types.Path;
@@ -1176,6 +1177,18 @@ public class Jar extends Zip {
             }
             for (int j = 0; j < resources[0].length; j++) {
                 String name = resources[0][j].getName().replace('\\', '/');
+                if (rcs[i] instanceof ArchiveFileSet) {
+                    ArchiveFileSet afs = (ArchiveFileSet) rcs[i];
+                    if (!"".equals(afs.getFullpath(getProject()))) {
+                        name = afs.getFullpath(getProject());
+                    } else if (!"".equals(afs.getPrefix(getProject()))) {
+                        String prefix = afs.getPrefix(getProject());
+                        if (!prefix.endsWith("/") && !prefix.endsWith("\\")) {
+                            prefix += "/";
+                        }
+                        name = prefix + name;
+                    }
+                }
                 if (name.equalsIgnoreCase(MANIFEST_NAME)) {
                     manifests[i] = new Resource[] {resources[0][j]};
                     break;

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Java.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Java.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Java.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Java.java Mon Dec 13 18:34:00 2010
@@ -732,7 +732,7 @@ public class Java extends Task {
         if (redirector.getErrorStream() != null) {
             redirector.handleErrorFlush(output);
         } else {
-            super.handleErrorOutput(output);
+            super.handleErrorFlush(output);
         }
     }
 

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Javac.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Javac.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Javac.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Javac.java Mon Dec 13 18:34:00 2010
@@ -31,6 +31,7 @@ import org.apache.tools.ant.DirectorySca
 import org.apache.tools.ant.MagicNames;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter;
+import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterExtension;
 import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory;
 import org.apache.tools.ant.types.Path;
 import org.apache.tools.ant.types.Reference;
@@ -79,6 +80,7 @@ public class Javac extends MatchingTask 
     private static final String FAIL_MSG
         = "Compile failed; see the compiler error output for details.";
 
+    private static final String JAVAC17 = "javac1.7";
     private static final String JAVAC16 = "javac1.6";
     private static final String JAVAC15 = "javac1.5";
     private static final String JAVAC14 = "javac1.4";
@@ -143,6 +145,8 @@ public class Javac extends MatchingTask 
             return JAVAC15;
         } else if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_6)) {
             return JAVAC16;
+        } else if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_7)) {
+            return JAVAC17;
         } else {
             return CLASSIC;
         }
@@ -594,7 +598,7 @@ public class Javac extends MatchingTask 
     /**
      * Sets the target VM that the classes will be compiled for. Valid
      * values depend on the compiler, for jdk 1.4 the valid values are
-     * "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "5" and "6".
+     * "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "5", "6" and "7".
      * @param target the target VM
      */
     public void setTarget(String target) {
@@ -758,7 +762,8 @@ public class Javac extends MatchingTask 
     }
 
     private String getAltCompilerName(String anImplementation) {
-        if (JAVAC16.equalsIgnoreCase(anImplementation)
+        if (JAVAC17.equalsIgnoreCase(anImplementation)
+                || JAVAC16.equalsIgnoreCase(anImplementation)
                 || JAVAC15.equalsIgnoreCase(anImplementation)
                 || JAVAC14.equalsIgnoreCase(anImplementation)
                 || JAVAC13.equalsIgnoreCase(anImplementation)) {
@@ -770,7 +775,8 @@ public class Javac extends MatchingTask 
         }
         if (MODERN.equalsIgnoreCase(anImplementation)) {
             String nextSelected = assumedJavaVersion();
-            if (JAVAC16.equalsIgnoreCase(nextSelected)
+            if (JAVAC17.equalsIgnoreCase(nextSelected)
+                    || JAVAC16.equalsIgnoreCase(nextSelected)
                     || JAVAC15.equalsIgnoreCase(nextSelected)
                     || JAVAC14.equalsIgnoreCase(nextSelected)
                     || JAVAC13.equalsIgnoreCase(nextSelected)) {
@@ -807,7 +813,7 @@ public class Javac extends MatchingTask 
     }
 
     /**
-     * The property to set on compliation success.
+     * The property to set on compilation success.
      * This property will not be set if the compilation
      * fails, or if there are no files to compile.
      * @param updatedProperty the property name to use.
@@ -818,7 +824,7 @@ public class Javac extends MatchingTask 
     }
 
     /**
-     * The property to set on compliation failure.
+     * The property to set on compilation failure.
      * This property will be set if the compilation
      * fails.
      * @param errorProperty the property name to use.
@@ -929,21 +935,51 @@ public class Javac extends MatchingTask 
      */
     protected void scanDir(File srcDir, File destDir, String[] files) {
         GlobPatternMapper m = new GlobPatternMapper();
-        m.setFrom("*.java");
-        m.setTo("*.class");
-        SourceFileScanner sfs = new SourceFileScanner(this);
-        File[] newFiles = sfs.restrictAsFiles(files, srcDir, destDir, m);
-
-        if (newFiles.length > 0) {
-            lookForPackageInfos(srcDir, newFiles);
-            File[] newCompileList
-                = new File[compileList.length + newFiles.length];
-            System.arraycopy(compileList, 0, newCompileList, 0,
-                    compileList.length);
-            System.arraycopy(newFiles, 0, newCompileList,
-                    compileList.length, newFiles.length);
-            compileList = newCompileList;
+        String[] extensions = findSupportedFileExtensions();
+        
+        for (int i = 0; i < extensions.length; i++) {
+            m.setFrom(extensions[i]);
+            m.setTo("*.class");
+            SourceFileScanner sfs = new SourceFileScanner(this);
+            File[] newFiles = sfs.restrictAsFiles(files, srcDir, destDir, m);
+
+            if (newFiles.length > 0) {
+                lookForPackageInfos(srcDir, newFiles);
+                File[] newCompileList
+                    = new File[compileList.length + newFiles.length];
+                System.arraycopy(compileList, 0, newCompileList, 0,
+                                 compileList.length);
+                System.arraycopy(newFiles, 0, newCompileList,
+                                 compileList.length, newFiles.length);
+                compileList = newCompileList;
+            }
+        }
+    }
+
+    private String[] findSupportedFileExtensions() {
+        String compilerImpl = getCompiler();
+        CompilerAdapter adapter =
+            nestedAdapter != null ? nestedAdapter :
+            CompilerAdapterFactory.getCompiler(compilerImpl, this,
+                                               createCompilerClasspath());
+        String[] extensions = null;
+        if (adapter instanceof CompilerAdapterExtension) {
+            extensions =
+                ((CompilerAdapterExtension) adapter).getSupportedFileExtensions();
+        } 
+
+        if (extensions == null) {
+            extensions = new String[] { "java" };
+        }
+
+        // now process the extensions to ensure that they are the
+        // right format
+        for (int i = 0; i < extensions.length; i++) {
+            if (!extensions[i].startsWith("*.")) {
+                extensions[i] = "*." + extensions[i];
+            }
         }
+        return extensions; 
     }
 
     /**
@@ -965,6 +1001,7 @@ public class Javac extends MatchingTask 
     protected boolean isJdkCompiler(String compilerImpl) {
         return MODERN.equals(compilerImpl)
             || CLASSIC.equals(compilerImpl)
+            || JAVAC17.equals(compilerImpl)
             || JAVAC16.equals(compilerImpl)
             || JAVAC15.equals(compilerImpl)
             || JAVAC14.equals(compilerImpl)

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java Mon Dec 13 18:34:00 2010
@@ -66,6 +66,7 @@ public class LoadProperties extends Task
      * Prefix for loaded properties.
      */
     private String prefix = null;
+    private boolean prefixValues = true;
 
     /**
      * Set the file to load.
@@ -142,6 +143,16 @@ public class LoadProperties extends Task
     }
 
     /**
+     * Whether to apply the prefix when expanding properties on the
+     * right hand side of a properties file as well.
+     *
+     * @since Ant 1.8.2
+     */
+    public void setPrefixValues(boolean b) {
+        prefixValues = b;
+    }
+
+    /**
      * load Ant properties from the source file or resource
      *
      * @exception BuildException if something goes wrong with the build
@@ -189,6 +200,7 @@ public class LoadProperties extends Task
                 Property propertyTask = new Property();
                 propertyTask.bindToOwner(this);
                 propertyTask.setPrefix(prefix);
+                propertyTask.setPrefixValues(prefixValues);
                 propertyTask.addProperties(props);
             }
         } catch (final IOException ioe) {

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java Mon Dec 13 18:34:00 2010
@@ -78,7 +78,6 @@ public class ManifestClassPath extends T
 
         String[] elements = path.list();
         StringBuffer buffer = new StringBuffer();
-        StringBuffer element = new StringBuffer();
         for (int i = 0; i < elements.length; ++i) {
             // Normalize the current file
             File pathEntry = new File(elements[i]);

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Mkdir.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Mkdir.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Mkdir.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Mkdir.java Mon Dec 13 18:34:00 2010
@@ -59,6 +59,12 @@ public class Mkdir extends Task {
         if (!dir.exists()) {
             boolean result = mkdirs(dir);
             if (!result) {
+                if (dir.exists()) {
+                    log("A different process or task has already created "
+                        + "dir " + dir.getAbsolutePath(),
+                        Project.MSG_VERBOSE);
+                    return;
+                }
                 String msg = "Directory " + dir.getAbsolutePath()
                     + " creation was not successful for an unknown reason";
                 throw new BuildException(msg, getLocation());

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Move.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Move.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Move.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Move.java Mon Dec 13 18:34:00 2010
@@ -233,9 +233,10 @@ public class Move extends Copy {
                                     getFilterChains(),
                                     forceOverwrite,
                                     getPreserveLastModified(),
+                                    /* append: */ false,
                                     getEncoding(),
                                     getOutputEncoding(),
-                                    getProject());
+                                    getProject(), getForce());
         } catch (IOException ioe) {
             String msg = "Failed to copy " + fromFile
                     + " to " + toFile + " due to " + ioe.getMessage();
@@ -329,6 +330,18 @@ public class Move extends Copy {
                 || getFilterChains().size() > 0) {
             return false;
         }
+
+        // identical logic lives in ResourceUtils.copyResource():
+        if (destFile.isFile() && !destFile.canWrite()) {
+            if (!getForce()) {
+                throw new IOException("can't replace read-only destination "
+                                      + "file " + destFile);
+            } else if (!getFileUtils().tryHardToDelete(destFile)) {
+                throw new IOException("failed to delete read-only "
+                                      + "destination file " + destFile);
+            }
+        }
+
         // identical logic lives in FileUtils.rename():
         File parent = destFile.getParentFile();
         if (parent != null && !parent.exists()) {
@@ -336,13 +349,13 @@ public class Move extends Copy {
         } else if (destFile.isFile()) {
             sourceFile = getFileUtils().normalize(sourceFile.getAbsolutePath()).getCanonicalFile();
             destFile = getFileUtils().normalize(destFile.getAbsolutePath());
-            if (destFile.equals(sourceFile)) {
+            if (destFile.getAbsolutePath().equals(sourceFile.getAbsolutePath())) {
                 //no point in renaming a file to its own canonical version...
                 log("Rename of " + sourceFile + " to " + destFile
                     + " is a no-op.", Project.MSG_VERBOSE);
                 return true;
             }
-            if (!(sourceFile.equals(destFile.getCanonicalFile()) || destFile.delete())) {
+            if (!(getFileUtils().areSame(sourceFile, destFile) || destFile.delete())) {
                 throw new BuildException("Unable to remove existing file " + destFile);
             }
         }

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Parallel.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Parallel.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Parallel.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Parallel.java Mon Dec 13 18:34:00 2010
@@ -17,7 +17,6 @@
  */
 package org.apache.tools.ant.taskdefs;
 
-import java.lang.reflect.Method;
 import java.util.Enumeration;
 import java.util.Vector;
 import java.util.List;
@@ -350,7 +349,10 @@ public class Parallel extends Task
                 interrupted = true;
             }
 
-            killAll(running);
+            if (!timedOut && !failOnAny) {
+                // https://issues.apache.org/bugzilla/show_bug.cgi?id=49527
+                killAll(running);
+            }
         }
 
         if (interrupted) {

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Property.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Property.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Property.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Property.java Mon Dec 13 18:34:00 2010
@@ -94,6 +94,7 @@ public class Property extends Task {
     private boolean valueAttributeUsed = false;
     private boolean relative = false;
     private File basedir;
+    private boolean prefixValues = false;
 
     protected boolean userProperty; // set read-only properties
     // CheckStyle:VisibilityModifier ON
@@ -294,6 +295,26 @@ public class Property extends Task {
     }
 
     /**
+     * Whether to apply the prefix when expanding properties on the
+     * right hand side of a properties file as well.
+     *
+     * @since Ant 1.8.2
+     */
+    public void setPrefixValues(boolean b) {
+        prefixValues = b;
+    }
+
+    /**
+     * Whether to apply the prefix when expanding properties on the
+     * right hand side of a properties file as well.
+     *
+     * @since Ant 1.8.2
+     */
+    public boolean getPrefixValues() {
+        return prefixValues;
+    }
+
+    /**
      * Sets a reference to an Ant datatype
      * declared elsewhere.
      * Only yields reasonable results for references
@@ -461,7 +482,7 @@ public class Property extends Task {
                 try {
                     File from = untypedValue instanceof File ? (File)untypedValue : new File(untypedValue.toString());
                     File to = basedir != null ? basedir : getProject().getBaseDir();
-                    String relPath = FileUtils.getFileUtils().getRelativePath(to, from);
+                    String relPath = FileUtils.getRelativePath(to, from);
                     relPath = relPath.replace('/', File.separatorChar);
                     addProperty(name, relPath);
                 } catch (Exception e) {
@@ -643,16 +664,10 @@ public class Property extends Task {
             prefix += ".";
         }
         log("Loading Environment " + prefix, Project.MSG_VERBOSE);
-        Vector osEnv = Execute.getProcEnvironment();
-        for (Enumeration e = osEnv.elements(); e.hasMoreElements();) {
-            String entry = (String) e.nextElement();
-            int pos = entry.indexOf('=');
-            if (pos == -1) {
-                log("Ignoring: " + entry, Project.MSG_WARN);
-            } else {
-                props.put(prefix + entry.substring(0, pos),
-                          entry.substring(pos + 1));
-            }
+        Map osEnv = Execute.getEnvironmentVariables();
+        for (Iterator e = osEnv.entrySet().iterator(); e.hasNext(); ) {
+            Map.Entry entry = (Map.Entry) e.next();
+            props.put(prefix + entry.getKey(), entry.getValue());
         }
         addProperties(props);
     }
@@ -716,7 +731,7 @@ public class Property extends Task {
                                getProject(),
                                propertyHelper,
                                propertyHelper.getExpanders())
-            .resolveAllProperties(props, prefix);
+            .resolveAllProperties(props, getPrefix(), getPrefixValues());
     }
 
 }

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java Mon Dec 13 18:34:00 2010
@@ -32,23 +32,38 @@ public class PumpStreamHandler implement
 
     private Thread outputThread;
     private Thread errorThread;
-    private StreamPumper inputPump;
+    private Thread inputThread;
 
     private OutputStream out;
     private OutputStream err;
     private InputStream input;
+    private final boolean nonBlockingRead;
 
     /**
      * Construct a new <code>PumpStreamHandler</code>.
      * @param out the output <code>OutputStream</code>.
      * @param err the error <code>OutputStream</code>.
      * @param input the input <code>InputStream</code>.
+     * @param nonBlockingRead set it to <code>true</code> if the input should be
+     *                      read with simulated non blocking IO.
      */
     public PumpStreamHandler(OutputStream out, OutputStream err,
-                             InputStream input) {
+                             InputStream input, boolean nonBlockingRead) {
         this.out = out;
         this.err = err;
         this.input = input;
+        this.nonBlockingRead = nonBlockingRead;
+    }
+
+    /**
+     * Construct a new <code>PumpStreamHandler</code>.
+     * @param out the output <code>OutputStream</code>.
+     * @param err the error <code>OutputStream</code>.
+     * @param input the input <code>InputStream</code>.
+     */
+    public PumpStreamHandler(OutputStream out, OutputStream err,
+                             InputStream input) {
+        this(out, err, input, false);
     }
 
     /**
@@ -102,7 +117,7 @@ public class PumpStreamHandler implement
      */
     public void setProcessInputStream(OutputStream os) {
         if (input != null) {
-            inputPump = createInputPump(input, os, true);
+            inputThread = createPump(input, os, true, nonBlockingRead);
         } else {
             try {
                 os.close();
@@ -118,9 +133,7 @@ public class PumpStreamHandler implement
     public void start() {
         outputThread.start();
         errorThread.start();
-        if (inputPump != null) {
-            Thread inputThread = new Thread(inputPump);
-            inputThread.setDaemon(true);
+        if (inputThread != null) {
             inputThread.start();
         }
     }
@@ -129,10 +142,7 @@ public class PumpStreamHandler implement
      * Stop pumping the streams.
      */
     public void stop() {
-
-        if (inputPump != null) {
-            inputPump.stop();
-        }
+        finish(inputThread);
 
         try {
             err.flush();
@@ -159,6 +169,10 @@ public class PumpStreamHandler implement
      * @since Ant 1.8.0
      */
     protected final void finish(Thread t) {
+        if (t == null) {
+            // nothing to terminate
+            return;
+        }
         try {
             StreamPumper s = null;
             if (t instanceof ThreadWithPumper) {
@@ -241,25 +255,30 @@ public class PumpStreamHandler implement
      */
     protected Thread createPump(InputStream is, OutputStream os,
                                 boolean closeWhenExhausted) {
-        final Thread result
-            = new ThreadWithPumper(new StreamPumper(is, os,
-                                                    closeWhenExhausted,
-                                                    true));
-        result.setDaemon(true);
-        return result;
+        return createPump(is, os, closeWhenExhausted, true);
     }
 
     /**
      * Creates a stream pumper to copy the given input stream to the
-     * given output stream. Used for standard input.
-     * @since Ant 1.6.3
+     * given output stream.
+     * @param is the input stream to copy from.
+     * @param os the output stream to copy to.
+     * @param closeWhenExhausted if true close the inputstream.
+     * @param nonBlockingIO set it to <code>true</code> to use simulated non
+     *                     blocking IO.
+     * @return a thread object that does the pumping, subclasses
+     * should return an instance of {@link ThreadWithPumper
+     * ThreadWithPumper}.
+     * @since Ant 1.8.2
      */
-    /*protected*/ StreamPumper createInputPump(InputStream is, OutputStream os,
-                                boolean closeWhenExhausted) {
-        StreamPumper pumper = new StreamPumper(is, os, closeWhenExhausted,
-                                               false);
-        pumper.setAutoflush(true);
-        return pumper;
+    protected Thread createPump(InputStream is, OutputStream os,
+                                boolean closeWhenExhausted, boolean nonBlockingIO) {
+        final Thread result
+            = new ThreadWithPumper(new StreamPumper(is, os,
+                                                    closeWhenExhausted,
+                                                    nonBlockingIO));
+        result.setDaemon(true);
+        return result;
     }
 
     /**

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Redirector.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Redirector.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Redirector.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Redirector.java Mon Dec 13 18:34:00 2010
@@ -753,9 +753,9 @@ public class Redirector {
      */
     public ExecuteStreamHandler createHandler() throws BuildException {
         createStreams();
+        boolean nonBlockingRead = input == null && inputString == null;
         return new PumpStreamHandler(getOutputStream(), getErrorStream(),
-                getInputStream());
-
+                getInputStream(), nonBlockingRead);
     }
 
     /**
@@ -843,6 +843,7 @@ public class Redirector {
                 errorPrintStream = new PrintStream(errorStream);
             }
             errorPrintStream.print(output);
+            errorPrintStream.flush();
         }
     }
 

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Replace.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Replace.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Replace.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Replace.java Mon Dec 13 18:34:00 2010
@@ -22,7 +22,6 @@ import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.FileReader;
 import java.io.FileWriter;

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/SignJar.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/SignJar.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/SignJar.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/SignJar.java Mon Dec 13 18:34:00 2010
@@ -378,7 +378,7 @@ public class SignJar extends AbstractJar
      * @throws BuildException
      */
     private void signOneJar(File jarSource, File jarTarget)
-            throws BuildException {
+        throws BuildException {
 
 
         File targetFile = jarTarget;
@@ -401,11 +401,15 @@ public class SignJar extends AbstractJar
             addValue(cmd, value);
         }
 
-        //DO NOT SET THE -signedjar OPTION if source==dest
-        //unless you like fielding hotspot crash reports
-        if (!jarSource.equals(targetFile)) {
-            addValue(cmd, "-signedjar");
-            addValue(cmd, targetFile.getPath());
+        try {
+            //DO NOT SET THE -signedjar OPTION if source==dest
+            //unless you like fielding hotspot crash reports
+            if (!FILE_UTILS.areSame(jarSource, targetFile)) {
+                addValue(cmd, "-signedjar");
+                addValue(cmd, targetFile.getPath());
+            }
+        } catch (IOException ioex) {
+            throw new BuildException(ioex);
         }
 
         if (internalsf) {
@@ -435,7 +439,7 @@ public class SignJar extends AbstractJar
 
         // restore the lastModified attribute
         if (preserveLastModified) {
-            targetFile.setLastModified(lastModified);
+            FILE_UTILS.setFileLastModified(targetFile, lastModified);
         }
     }
 

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/VerifyJar.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/VerifyJar.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/VerifyJar.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/VerifyJar.java Mon Dec 13 18:34:00 2010
@@ -26,7 +26,6 @@ import org.apache.tools.ant.types.Filter
 import org.apache.tools.ant.types.Path;
 import org.apache.tools.ant.types.Resource;
 import org.apache.tools.ant.types.resources.FileProvider;
-import org.apache.tools.ant.types.resources.FileResource;
 
 import java.util.Iterator;
 import java.io.File;

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java Mon Dec 13 18:34:00 2010
@@ -336,6 +336,8 @@ public class XSLTProcess extends Matchin
             return;
         }
         try {
+            setupLoader();
+
             if (sysProperties.size() > 0) {
                 sysProperties.setSystem();
             }
@@ -689,15 +691,26 @@ public class XSLTProcess extends Matchin
      * @exception Exception if the class could not be loaded.
      */
     private Class loadClass(String classname) throws Exception {
-        if (classpath == null) {
+        setupLoader();
+        if (loader == null) {
             return Class.forName(classname);
         }
-        loader = getProject().createClassLoader(classpath);
-        loader.setThreadContextLoader();
         return Class.forName(classname, true, loader);
     }
 
     /**
+     * If a custom classpath has been defined but no loader created
+     * yet, create the classloader and set it as the context
+     * classloader.
+     */
+    private void setupLoader() {
+        if (classpath != null && loader == null) {
+            loader = getProject().createClassLoader(classpath);
+            loader.setThreadContextLoader();
+        }
+    }
+
+    /**
      * Specifies the output name for the styled result from the
      * <tt>in</tt> attribute; required if <tt>in</tt> is set
      *
@@ -910,7 +923,8 @@ public class XSLTProcess extends Matchin
             } else {
                 try {
                     resolveProcessor(PROCESSOR_TRAX);
-                } catch (Exception e1) { // should not happen
+                } catch (Throwable e1) {
+                    e1.printStackTrace();
                     handleError(e1);
                 }
             }

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Zip.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Zip.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Zip.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Zip.java Mon Dec 13 18:34:00 2010
@@ -1243,6 +1243,19 @@ public class Zip extends MatchingTask {
         return new ArchiveState(as2.isOutOfDate(), toAdd);
     }
 
+    /*
+     * This is yet another hacky construct to extend the FileSet[]
+     * getResourcesToAdd method so we can pass the information whether
+     * non-fileset resources have been available to it without having
+     * to move the withEmpty behavior checks (since either would break
+     * subclasses in several ways).
+     */
+    private static ThreadLocal haveNonFileSetResourcesToAdd = new ThreadLocal() {
+            protected Object initialValue() {
+                return Boolean.FALSE;
+            }
+        };
+
     /**
      * Collect the resources that are newer than the corresponding
      * entries (or missing) in the original archive.
@@ -1272,48 +1285,55 @@ public class Zip extends MatchingTask {
 
         Resource[][] initialResources = grabResources(filesets);
         if (isEmpty(initialResources)) {
-            if (needsUpdate && doUpdate) {
-                /*
-                 * This is a rather hairy case.
-                 *
-                 * One of our subclasses knows that we need to update the
-                 * archive, but at the same time, there are no resources
-                 * known to us that would need to be added.  Only the
-                 * subclass seems to know what's going on.
-                 *
-                 * This happens if <jar> detects that the manifest has changed,
-                 * for example.  The manifest is not part of any resources
-                 * because of our support for inline <manifest>s.
-                 *
-                 * If we invoke createEmptyZip like Ant 1.5.2 did,
-                 * we'll loose all stuff that has been in the original
-                 * archive (bugzilla report 17780).
-                 */
-                return new ArchiveState(true, initialResources);
-            }
-
-            if (emptyBehavior.equals("skip")) {
-                if (doUpdate) {
-                    logWhenWriting(archiveType + " archive " + zipFile
-                                   + " not updated because no new files were"
-                                   + " included.", Project.MSG_VERBOSE);
+            if (Boolean.FALSE.equals(haveNonFileSetResourcesToAdd.get())) {
+                if (needsUpdate && doUpdate) {
+                    /*
+                     * This is a rather hairy case.
+                     *
+                     * One of our subclasses knows that we need to
+                     * update the archive, but at the same time, there
+                     * are no resources known to us that would need to
+                     * be added.  Only the subclass seems to know
+                     * what's going on.
+                     *
+                     * This happens if <jar> detects that the manifest
+                     * has changed, for example.  The manifest is not
+                     * part of any resources because of our support
+                     * for inline <manifest>s.
+                     *
+                     * If we invoke createEmptyZip like Ant 1.5.2 did,
+                     * we'll loose all stuff that has been in the
+                     * original archive (bugzilla report 17780).
+                     */
+                    return new ArchiveState(true, initialResources);
+                }
+
+                if (emptyBehavior.equals("skip")) {
+                    if (doUpdate) {
+                        logWhenWriting(archiveType + " archive " + zipFile
+                                       + " not updated because no new files were"
+                                       + " included.", Project.MSG_VERBOSE);
+                    } else {
+                        logWhenWriting("Warning: skipping " + archiveType
+                                       + " archive " + zipFile
+                                       + " because no files were included.",
+                                       Project.MSG_WARN);
+                    }
+                } else if (emptyBehavior.equals("fail")) {
+                    throw new BuildException("Cannot create " + archiveType
+                                             + " archive " + zipFile
+                                             + ": no files were included.",
+                                             getLocation());
                 } else {
-                    logWhenWriting("Warning: skipping " + archiveType
-                                   + " archive " + zipFile
-                                   + " because no files were included.",
-                                   Project.MSG_WARN);
-                }
-            } else if (emptyBehavior.equals("fail")) {
-                throw new BuildException("Cannot create " + archiveType
-                                         + " archive " + zipFile
-                                         + ": no files were included.",
-                                         getLocation());
-            } else {
-                // Create.
-                if (!zipFile.exists())  {
-                    needsUpdate = true;
+                    // Create.
+                    if (!zipFile.exists())  {
+                        needsUpdate = true;
+                    }
                 }
             }
+
+            // either there are non-fileset resources or we
+            // (re-)create the archive anyway
             return new ArchiveState(needsUpdate, initialResources);
         }
 
@@ -1429,7 +1449,9 @@ public class Zip extends MatchingTask {
          */
 
         Resource[][] initialResources = grabNonFileSetResources(rcs);
-        if (isEmpty(initialResources)) {
+        boolean empty = isEmpty(initialResources);
+        haveNonFileSetResourcesToAdd.set(Boolean.valueOf(!empty));
+        if (empty) {
             // no emptyBehavior handling since the FileSet version
             // will take care of it.
             return new ArchiveState(needsUpdate, initialResources);
@@ -1934,6 +1956,7 @@ public class Zip extends MatchingTask {
             resources.removeElement(zf);
         }
         filesetsFromGroupfilesets.removeAllElements();
+        haveNonFileSetResourcesToAdd.set(Boolean.FALSE);
     }
 
     /**

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java Mon Dec 13 18:34:00 2010
@@ -119,7 +119,8 @@ public final class CompilerAdapterFactor
                 || compilerType.equalsIgnoreCase("javac1.3")
                 || compilerType.equalsIgnoreCase("javac1.4")
                 || compilerType.equalsIgnoreCase("javac1.5")
-                || compilerType.equalsIgnoreCase("javac1.6")) {
+                || compilerType.equalsIgnoreCase("javac1.6")
+                || compilerType.equalsIgnoreCase("javac1.7")) {
                 // does the modern compiler exist?
                 if (doesModernCompilerExist()) {
                     return new Javac13();

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java Mon Dec 13 18:34:00 2010
@@ -44,8 +44,18 @@ import org.apache.tools.ant.taskdefs.con
  *
  * @since Ant 1.3
  */
-public abstract class DefaultCompilerAdapter implements CompilerAdapter {
-    private static final int COMMAND_LINE_LIMIT = 4096;  // 4K
+public abstract class DefaultCompilerAdapter
+    implements CompilerAdapter, CompilerAdapterExtension {
+
+    private static final int COMMAND_LINE_LIMIT;
+    static {
+        if (Os.isFamily("os/2")) {
+            // OS/2 CMD.EXE has a much smaller limit around 1K
+            COMMAND_LINE_LIMIT = 1000;
+        } else {
+            COMMAND_LINE_LIMIT = 4096;  // 4K
+        }
+    }
     // CheckStyle:VisibilityModifier OFF - bc
 
     private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
@@ -120,6 +130,15 @@ public abstract class DefaultCompilerAda
     }
 
     /**
+     * By default, only recognize files with a Java extension,
+     * but specialized compilers can recognize multiple kinds
+     * of files.
+     */
+    public String[] getSupportedFileExtensions() {
+        return new String[] { "java" };
+    }
+
+    /**
      * Get the project this compiler adapter was created in.
      * @return the owner project
      * @since Ant 1.6
@@ -324,13 +343,12 @@ public abstract class DefaultCompilerAda
             String source = attributes.getSource();
             if (source.equals("1.1") || source.equals("1.2")) {
                 // support for -source 1.1 and -source 1.2 has been
-                // added with JDK 1.4.2 - and isn't present in 1.5.0
-                // or 1.6.0 either
+                // added with JDK 1.4.2 - and isn't present in 1.5.0+
                 cmd.createArgument().setValue("1.3");
             } else {
                 cmd.createArgument().setValue(source);
             }
-        } else if ((assumeJava15() || assumeJava16())
+        } else if ((assumeJava15() || assumeJava16() || assumeJava17())
                    && attributes.getTarget() != null) {
             String t = attributes.getTarget();
             if (t.equals("1.1") || t.equals("1.2") || t.equals("1.3")
@@ -340,19 +358,12 @@ public abstract class DefaultCompilerAda
                     // 1.5.0 doesn't support -source 1.1
                     s = "1.2";
                 }
-                attributes.log("", Project.MSG_WARN);
-                attributes.log("          WARNING", Project.MSG_WARN);
-                attributes.log("", Project.MSG_WARN);
-                attributes.log("The -source switch defaults to 1.5 in JDK 1.5 and 1.6.",
-                               Project.MSG_WARN);
-                attributes.log("If you specify -target " + t
-                               + " you now must also specify -source " + s
-                               + ".", Project.MSG_WARN);
-                attributes.log("Ant will implicitly add -source " + s
-                               + " for you.  Please change your build file.",
-                               Project.MSG_WARN);
-                cmd.createArgument().setValue("-source");
-                cmd.createArgument().setValue(s);
+                setImplicitSourceSwitch((assumeJava15() || assumeJava16())
+                                        ? "1.5 in JDK 1.5 and 1.6"
+                                        : "1.7 in JDK 1.7",
+                                        cmd, s, t);
+            } else if (assumeJava17() && (t.equals("1.5") || t.equals("1.6"))) {
+                setImplicitSourceSwitch("1.7 in JDK 1.7", cmd, t, t);
             }
         }
         return cmd;
@@ -612,6 +623,21 @@ public abstract class DefaultCompilerAda
     }
 
     /**
+     * Shall we assume JDK 1.7 command line switches?
+     * @return true if JDK 1.7
+     * @since Ant 1.8.2
+     */
+    protected boolean assumeJava17() {
+        return "javac1.7".equals(attributes.getCompilerVersion())
+            || ("classic".equals(attributes.getCompilerVersion())
+                && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_7))
+            || ("modern".equals(attributes.getCompilerVersion())
+                && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_7))
+            || ("extJavac".equals(attributes.getCompilerVersion())
+                && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_7));
+    }
+
+    /**
      * Combines a user specified bootclasspath with the system
      * bootclasspath taking build.sysclasspath into account.
      *
@@ -639,5 +665,23 @@ public abstract class DefaultCompilerAda
     protected String getNoDebugArgument() {
         return assumeJava11() ? null : "-g:none";
     }
+
+    private void setImplicitSourceSwitch(String defaultDetails, Commandline cmd,
+                                         String target, String source) {
+        attributes.log("", Project.MSG_WARN);
+        attributes.log("          WARNING", Project.MSG_WARN);
+        attributes.log("", Project.MSG_WARN);
+        attributes.log("The -source switch defaults to " + defaultDetails + ".",
+                       Project.MSG_WARN);
+        attributes.log("If you specify -target " + target
+                       + " you now must also specify -source " + source
+                       + ".", Project.MSG_WARN);
+        attributes.log("Ant will implicitly add -source " + source
+                       + " for you.  Please change your build file.",
+                       Project.MSG_WARN);
+        cmd.createArgument().setValue("-source");
+        cmd.createArgument().setValue(source);
+    }
+
 }
 

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/condition/Matches.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/condition/Matches.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/condition/Matches.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/condition/Matches.java Mon Dec 13 18:34:00 2010
@@ -19,9 +19,9 @@ package org.apache.tools.ant.taskdefs.co
 
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.ProjectComponent;
-import org.apache.tools.ant.util.regexp.Regexp;
 import org.apache.tools.ant.types.RegularExpression;
-import org.apache.tools.ant.util.regexp.RegexpMatcher;
+import org.apache.tools.ant.util.regexp.Regexp;
+import org.apache.tools.ant.util.regexp.RegexpUtil;
 
 /**
  * Simple regular expression condition.
@@ -112,16 +112,7 @@ public class Matches extends ProjectComp
         if (regularExpression == null) {
             throw new BuildException("Missing pattern in matches.");
         }
-        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;
-        }
+        int options = RegexpUtil.asOptions(caseSensitive, multiLine, singleLine);
         Regexp regexp = regularExpression.getRegexp(getProject());
         return regexp.matches(string, options);
     }

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/defaults.properties
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/defaults.properties?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/defaults.properties (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/defaults.properties Mon Dec 13 18:34:00 2010
@@ -23,6 +23,7 @@ apt=org.apache.tools.ant.taskdefs.Apt
 augment=org.apache.tools.ant.taskdefs.AugmentReference
 available=org.apache.tools.ant.taskdefs.Available
 basename=org.apache.tools.ant.taskdefs.Basename
+bindtargets=org.apache.tools.ant.taskdefs.BindTargets
 buildnumber=org.apache.tools.ant.taskdefs.BuildNumber
 bunzip2=org.apache.tools.ant.taskdefs.BUnzip2
 bzip2=org.apache.tools.ant.taskdefs.BZip2
@@ -81,6 +82,7 @@ parallel=org.apache.tools.ant.taskdefs.P
 patch=org.apache.tools.ant.taskdefs.Patch
 pathconvert=org.apache.tools.ant.taskdefs.PathConvert
 presetdef=org.apache.tools.ant.taskdefs.PreSetDef
+projecthelper=org.apache.tools.ant.taskdefs.ProjectHelperTask
 property=org.apache.tools.ant.taskdefs.Property
 propertyhelper=org.apache.tools.ant.taskdefs.PropertyHelperTask
 record=org.apache.tools.ant.taskdefs.Recorder

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java Mon Dec 13 18:34:00 2010
@@ -69,7 +69,7 @@ public class EmailTask extends Task {
     private String encoding = AUTO;
     /** host running SMTP  */
     private String host = "localhost";
-    private int port = SMTP_PORT;
+    private Integer port = null;
     /** subject field  */
     private String subject = null;
     /** any text  */
@@ -161,7 +161,7 @@ public class EmailTask extends Task {
      * @param port The port to use.
      */
     public void setMailport(int port) {
-        this.port = port;
+        this.port = new Integer(port);
     }
 
     /**
@@ -549,7 +549,13 @@ public class EmailTask extends Task {
 
             // pass the params to the mailer
             mailer.setHost(host);
-            mailer.setPort(port);
+            if (port != null) {
+                mailer.setPort(port.intValue());
+                mailer.setPortExplicitlySpecified(true);
+            } else {
+                mailer.setPort(SMTP_PORT);
+                mailer.setPortExplicitlySpecified(false);
+            }
             mailer.setUser(user);
             mailer.setPassword(password);
             mailer.setSSL(ssl);



Mime
View raw message