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/04/30 22:28:12 UTC

svn commit: r939802 [4/7] - in /ant/core/branches/ANT_SITE: ./ docs/ docs/antlibs/ docs/manual/ docs/manual/CoreTasks/ docs/manual/CoreTypes/ docs/manual/OptionalTasks/ docs/webtest/gettest/ lib/ src/etc/ src/etc/poms/ src/etc/poms/ant-apache-xalan2/ s...

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=939802&r1=939801&r2=939802&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 Fri Apr 30 20:28:06 2010
@@ -1203,9 +1203,7 @@ public class Execute {
                     out.write(cmd[i]);
                 }
             } finally {
-                if (out != null) {
-                    out.close();
-                }
+                FileUtils.close(out);
             }
             return script;
         }

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=939802&r1=939801&r2=939802&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 Fri Apr 30 20:28:06 2010
@@ -20,7 +20,7 @@ package org.apache.tools.ant.taskdefs;
 
 import java.io.File;
 import java.io.IOException;
-import java.util.Hashtable;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Vector;
 import org.apache.tools.ant.BuildException;
@@ -527,7 +527,7 @@ public class ExecuteOn extends ExecTask 
         final char fileSeparator = File.separatorChar;
         Vector targets = new Vector();
         if (targetFilePos != null) {
-            Hashtable addedFiles = new Hashtable();
+            HashSet addedFiles = new HashSet();
             for (int i = 0; i < srcFiles.length; i++) {
                 String[] subTargets = mapper.mapFileName(srcFiles[i]);
                 if (subTargets != null) {
@@ -543,7 +543,7 @@ public class ExecuteOn extends ExecTask 
                         }
                         if (!addedFiles.contains(name)) {
                             targets.addElement(name);
-                            addedFiles.put(name, name);
+                            addedFiles.add(name);
                         }
                     }
                 }

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=939802&r1=939801&r2=939802&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 Fri Apr 30 20:28:06 2010
@@ -658,7 +658,12 @@ public class Get extends Task {
                         .setUseCaches(httpUseCaches);
             }
             // connect to the remote site (may take some time)
-            connection.connect();
+            try {
+                connection.connect();
+            } catch (NullPointerException e) {
+                //bad URLs can trigger NPEs in some JVMs
+                throw new BuildException("Failed to parse " + source.toString(), e);
+            }
 
             // First check on a 301 / 302 (moved) response (HTTP only)
             if (connection instanceof HttpURLConnection) {
@@ -673,7 +678,7 @@ public class Get extends Task {
                             + (responseCode == HttpURLConnection.HTTP_MOVED_PERM ? " permanently"
                                     : "") + " moved to " + newLocation;
                     log(message, logLevel);
-                    URL newURL = new URL(newLocation);
+                    URL newURL = new URL(aSource, newLocation);
                     if (!redirectionAllowed(aSource, newURL))
                     {
                         return null;

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=939802&r1=939801&r2=939802&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 Fri Apr 30 20:28:06 2010
@@ -249,7 +249,8 @@ public class Jar extends Zip {
      * jars on Java 1.4 or earlier Ant will not include META-INF
      * unless explicitly asked to.</p>
      *
-     * @see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4408526
+     * @see <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4408526">
+     * jar -i omits service providers in index.list</a>
      * @since Ant 1.8.0
      * @param flag a <code>boolean</code> value, defaults to false
      */
@@ -812,7 +813,15 @@ public class Jar extends Zip {
             // manifest this means we claim an update was needed and
             // only include the manifests, skipping any uptodate
             // checks here defering them for the second run
-            return new ArchiveState(true, grabManifests(rcs));
+            Resource[][] manifests = grabManifests(rcs);
+            int count = 0;
+            for (int i = 0; i < manifests.length; i++) {
+                count += manifests[i].length;
+            }
+            log("found a total of " + count + " manifests in "
+                + manifests.length + " resource collections",
+                Project.MSG_VERBOSE);
+            return new ArchiveState(true, manifests);
         }
 
         // need to handle manifest as a special check
@@ -1166,7 +1175,8 @@ public class Jar extends Zip {
                     });
             }
             for (int j = 0; j < resources[0].length; j++) {
-                if (resources[0][j].getName().equalsIgnoreCase(MANIFEST_NAME)) {
+                String name = resources[0][j].getName().replace('\\', '/');
+                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/Javac.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Javac.java?rev=939802&r1=939801&r2=939802&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 Fri Apr 30 20:28:06 2010
@@ -679,7 +679,7 @@ public class Javac extends MatchingTask 
      * @return true if this is a forked invocation
      */
     public boolean isForkedJavac() {
-        return fork || "extJavac".equals(getCompiler());
+        return fork || EXTJAVAC.equalsIgnoreCase(getCompiler());
     }
 
     /**
@@ -777,7 +777,7 @@ public class Javac extends MatchingTask 
                 return nextSelected;
             }
         }
-        if (CLASSIC.equals(anImplementation)) {
+        if (CLASSIC.equalsIgnoreCase(anImplementation)) {
             return assumedJavaVersion();
         }
         if (EXTJAVAC.equalsIgnoreCase(anImplementation)) {
@@ -1007,7 +1007,7 @@ public class Javac extends MatchingTask 
         String compilerImpl = getCompilerVersion();
         if (fork) {
             if (isJdkCompiler(compilerImpl)) {
-                compilerImpl = "extJavac";
+                compilerImpl = EXTJAVAC;
             } else {
                 log("Since compiler setting isn't classic or modern, "
                     + "ignoring fork setting.", Project.MSG_WARN);

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Javadoc.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Javadoc.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Javadoc.java Fri Apr 30 20:28:06 2010
@@ -28,6 +28,7 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Enumeration;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Locale;
 import java.util.StringTokenizer;
@@ -1342,7 +1343,7 @@ public class Javadoc extends Task {
          * specified.
          */
         public void setScope (String verboseScope) throws BuildException {
-            verboseScope = verboseScope.toLowerCase(Locale.US);
+            verboseScope = verboseScope.toLowerCase(Locale.ENGLISH);
 
             boolean[] elements = new boolean[SCOPE_ELEMENTS.length];
 
@@ -2320,7 +2321,7 @@ public class Javadoc extends Task {
      * @since 1.5
      */
     private void parsePackages(Vector pn, Path sp) {
-        Vector addedPackages = new Vector();
+        HashSet addedPackages = new HashSet();
         Vector dirSets = (Vector) packageSets.clone();
 
         // for each sourcePath entry, add a directoryset with includes
@@ -2403,7 +2404,7 @@ public class Javadoc extends Task {
                         String packageName =
                             dirs[i].replace(File.separatorChar, '.');
                         if (!addedPackages.contains(packageName)) {
-                            addedPackages.addElement(packageName);
+                            addedPackages.add(packageName);
                             pn.addElement(packageName);
                         }
                     }

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Jikes.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Jikes.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Jikes.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Jikes.java Fri Apr 30 20:28:06 2010
@@ -21,6 +21,7 @@ import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.util.Locale;
 
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
@@ -81,7 +82,7 @@ public class Jikes {
             // Windows has a 32k limit on total arg size, so
             // create a temporary file to store all the arguments
 
-            if (myos.toLowerCase().indexOf("windows") >= 0
+            if (myos.toLowerCase(Locale.ENGLISH).indexOf("windows") >= 0
                 && args.length > MAX_FILES_ON_COMMAND_LINE) {
                 BufferedWriter out = null;
                 try {

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/KeySubst.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/KeySubst.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/KeySubst.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/KeySubst.java Fri Apr 30 20:28:06 2010
@@ -28,6 +28,7 @@ import java.util.Hashtable;
 import java.util.StringTokenizer;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Task;
+import org.apache.tools.ant.util.FileUtils;
 
 /**
  * Keyword substitution. Input file is written to output file.
@@ -80,20 +81,8 @@ public class KeySubst extends Task {
         } catch (IOException ioe) {
             ioe.printStackTrace();
         } finally {
-            if (bw != null) {
-                try {
-                    bw.close();
-                } catch (IOException e) {
-                    // ignore
-                }
-            }
-            if (br != null) {
-                try {
-                    br.close();
-                } catch (IOException e) {
-                    // ignore
-                }
-            }
+            FileUtils.close(bw);
+            FileUtils.close(br);
         }
     }
 

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Length.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Length.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Length.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Length.java Fri Apr 30 20:28:06 2010
@@ -68,6 +68,14 @@ public class Length extends Task impleme
     }
 
     /**
+     * Set the single resource for this task.
+     * @param resource the Resource whose length to retrieve.
+     */
+    public synchronized void setResource(Resource resource) {
+        add(resource);
+    }
+
+    /**
      * Set the single file for this task.
      * @param file the <code>File</code> whose length to retrieve.
      */

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=939802&r1=939801&r2=939802&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 Fri Apr 30 20:28:06 2010
@@ -37,6 +37,7 @@ import org.apache.tools.ant.types.Filter
 import org.apache.tools.ant.types.resources.FileResource;
 import org.apache.tools.ant.types.resources.JavaResource;
 import org.apache.tools.ant.util.FileUtils;
+import org.apache.tools.ant.util.ResourceUtils;
 
 /**
  * Load a file's contents as Ant properties.
@@ -60,6 +61,11 @@ public class LoadProperties extends Task
      * Encoding to use for input; defaults to the platform's default encoding.
      */
     private String encoding = null;
+    
+    /**
+     * Prefix for loaded properties.
+     */
+    private String prefix = null;
 
     /**
      * Set the file to load.
@@ -128,6 +134,14 @@ public class LoadProperties extends Task
     }
 
     /**
+     * Set the prefix to load these properties under.
+     * @param prefix to set
+     */
+    public void setPrefix(String prefix) {
+        this.prefix = prefix;
+    }
+
+    /**
      * load Ant properties from the source file or resource
      *
      * @exception BuildException if something goes wrong with the build
@@ -168,12 +182,13 @@ public class LoadProperties extends Task
                 if (!text.endsWith("\n")) {
                     text = text + "\n";
                 }
-                tis = new ByteArrayInputStream(text.getBytes("ISO8859_1"));
+                tis = new ByteArrayInputStream(text.getBytes(ResourceUtils.ISO_8859_1));
                 final Properties props = new Properties();
                 props.load(tis);
 
                 Property propertyTask = new Property();
                 propertyTask.bindToOwner(this);
+                propertyTask.setPrefix(prefix);
                 propertyTask.addProperties(props);
             }
         } catch (final IOException ioe) {

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/MacroDef.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/MacroDef.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/MacroDef.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/MacroDef.java Fri Apr 30 20:28:06 2010
@@ -339,7 +339,7 @@ public class MacroDef extends AntlibDefi
                 throw new BuildException(
                     "Illegal name [" + name + "] for attribute");
             }
-            this.name = name.toLowerCase(Locale.US);
+            this.name = name.toLowerCase(Locale.ENGLISH);
         }
 
         /**
@@ -443,7 +443,7 @@ public class MacroDef extends AntlibDefi
                 throw new BuildException(
                     "Illegal name [" + name + "] for attribute");
             }
-            this.name = name.toLowerCase(Locale.US);
+            this.name = name.toLowerCase(Locale.ENGLISH);
         }
 
         /**
@@ -567,7 +567,7 @@ public class MacroDef extends AntlibDefi
                 throw new BuildException(
                     "Illegal name [" + name + "] for macro element");
             }
-            this.name = name.toLowerCase(Locale.US);
+            this.name = name.toLowerCase(Locale.ENGLISH);
         }
 
         /**

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/MacroInstance.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/MacroInstance.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/MacroInstance.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/MacroInstance.java Fri Apr 30 20:28:06 2010
@@ -127,7 +127,7 @@ public class MacroInstance extends Task 
         for (Iterator i = unknownElements.iterator(); i.hasNext();) {
             UnknownElement ue = (UnknownElement) i.next();
             String name = ProjectHelper.extractNameFromComponentName(
-                ue.getTag()).toLowerCase(Locale.US);
+                ue.getTag()).toLowerCase(Locale.ENGLISH);
             if (getNsElements().get(name) == null) {
                 throw new BuildException("unsupported element " + name);
             }
@@ -199,7 +199,7 @@ public class MacroInstance extends Task 
                 case STATE_EXPECT_NAME:
                     if (ch == '}') {
                         state = STATE_NORMAL;
-                        String name = macroName.toString().toLowerCase(Locale.US);
+                        String name = macroName.toString().toLowerCase(Locale.ENGLISH);
                         String value = (String) macroMapping.get(name);
                         if (value == null) {
                             ret.append("@{");
@@ -278,7 +278,7 @@ public class MacroInstance extends Task 
             UnknownElement unknownElement = (UnknownElement) r.getProxy();
             String tag = unknownElement.getTaskType();
             if (tag != null) {
-                tag = tag.toLowerCase(Locale.US);
+                tag = tag.toLowerCase(Locale.ENGLISH);
             }
             MacroDef.TemplateElement templateElement =
                 (MacroDef.TemplateElement) getNsElements().get(tag);

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Manifest.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Manifest.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Manifest.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Manifest.java Fri Apr 30 20:28:06 2010
@@ -27,9 +27,13 @@ import java.io.Reader;
 import java.io.StringWriter;
 import java.io.UnsupportedEncodingException;
 import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Locale;
+import java.util.Map;
 import java.util.Vector;
 import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.util.CollectionUtils;
 import org.apache.tools.ant.util.FileUtils;
 
 /**
@@ -87,6 +91,15 @@ public class Manifest {
     /** Encoding to be used for JAR files. */
     public static final String JAR_ENCODING = "UTF-8";
 
+    private static final String ATTRIBUTE_MANIFEST_VERSION_LC =
+        ATTRIBUTE_MANIFEST_VERSION.toLowerCase(Locale.ENGLISH);
+    private static final String ATTRIBUTE_NAME_LC =
+        ATTRIBUTE_NAME.toLowerCase(Locale.ENGLISH);
+    private static final String ATTRIBUTE_FROM_LC =
+        ATTRIBUTE_FROM.toLowerCase(Locale.ENGLISH);
+    private static final String ATTRIBUTE_CLASSPATH_LC =
+        ATTRIBUTE_CLASSPATH.toLowerCase(Locale.ENGLISH);
+
     /**
      * An attribute for the manifest.
      * Those attributes that are not nested into a section will be added to the "Main" section.
@@ -235,7 +248,7 @@ public class Manifest {
             if (name == null) {
                 return null;
             }
-            return name.toLowerCase();
+            return name.toLowerCase(Locale.ENGLISH);
         }
 
         /**
@@ -398,10 +411,7 @@ public class Manifest {
         private String name = null;
 
         /** The section's attributes.*/
-        private Hashtable attributes = new Hashtable();
-
-        /** Index used to retain the attribute ordering */
-        private Vector attributeIndex = new Vector();
+        private Map attributes = new LinkedHashMap();
 
         /**
          * The name of the section; optional -default is the main section.
@@ -491,8 +501,10 @@ public class Manifest {
         public void merge(Section section, boolean mergeClassPaths)
             throws ManifestException {
             if (name == null && section.getName() != null
-                || name != null
-                && !(name.equalsIgnoreCase(section.getName()))) {
+                || (name != null && section.getName() != null
+                    && !(name.toLowerCase(Locale.ENGLISH)
+                         .equals(section.getName().toLowerCase(Locale.ENGLISH))))
+                ) {
                 throw new ManifestException("Unable to merge sections "
                     + "with different names");
             }
@@ -586,7 +598,7 @@ public class Manifest {
          *         instances.
          */
         public Attribute getAttribute(String attributeName) {
-            return (Attribute) attributes.get(attributeName.toLowerCase());
+            return (Attribute) attributes.get(attributeName.toLowerCase(Locale.ENGLISH));
         }
 
         /**
@@ -596,7 +608,7 @@ public class Manifest {
          *         key of an attribute of the section.
          */
         public Enumeration getAttributeKeys() {
-            return attributeIndex.elements();
+            return CollectionUtils.asEnumeration(attributes.keySet().iterator());
         }
 
         /**
@@ -608,7 +620,7 @@ public class Manifest {
          *         in the section
          */
         public String getAttributeValue(String attributeName) {
-            Attribute attribute = getAttribute(attributeName.toLowerCase());
+            Attribute attribute = getAttribute(attributeName.toLowerCase(Locale.ENGLISH));
             if (attribute == null) {
                 return null;
             }
@@ -621,9 +633,8 @@ public class Manifest {
          * @param attributeName the name of the attribute to be removed.
          */
         public void removeAttribute(String attributeName) {
-            String key = attributeName.toLowerCase();
+            String key = attributeName.toLowerCase(Locale.ENGLISH);
             attributes.remove(key);
-            attributeIndex.removeElement(key);
         }
 
         /**
@@ -659,7 +670,8 @@ public class Manifest {
             if (attribute.getName() == null || attribute.getValue() == null) {
                 throw new BuildException("Attributes must have name and value");
             }
-            if (attribute.getKey().equalsIgnoreCase(ATTRIBUTE_NAME)) {
+            String attributeKey = attribute.getKey();
+            if (attributeKey.equals(ATTRIBUTE_NAME_LC)) {
                 warnings.addElement("\"" + ATTRIBUTE_NAME + "\" attributes "
                     + "should not occur in the main section and must be the "
                     + "first element in all other sections: \""
@@ -667,13 +679,12 @@ public class Manifest {
                 return attribute.getValue();
             }
 
-            if (attribute.getKey().startsWith(ATTRIBUTE_FROM.toLowerCase())) {
+            if (attributeKey.startsWith(ATTRIBUTE_FROM_LC)) {
                 warnings.addElement(ERROR_FROM_FORBIDDEN
                     + attribute.getName() + ": " + attribute.getValue() + "\"");
             } else {
                 // classpath attributes go into a vector
-                String attributeKey = attribute.getKey();
-                if (attributeKey.equalsIgnoreCase(ATTRIBUTE_CLASSPATH)) {
+                if (attributeKey.equals(ATTRIBUTE_CLASSPATH_LC)) {
                     Attribute classpathAttribute =
                         (Attribute) attributes.get(attributeKey);
 
@@ -731,9 +742,6 @@ public class Manifest {
             }
             String attributeKey = attribute.getKey();
             attributes.put(attributeKey, attribute);
-            if (!attributeIndex.contains(attributeKey)) {
-                attributeIndex.addElement(attributeKey);
-            }
         }
 
         /**
@@ -781,10 +789,7 @@ public class Manifest {
     private Section mainSection = new Section();
 
     /** The named sections of this manifest */
-    private Hashtable sections = new Hashtable();
-
-    /** Index of sections - used to retain order of sections in manifest */
-    private Vector sectionIndex = new Vector();
+    private Map sections = new LinkedHashMap();
 
     /**
      * Construct a manifest from Ant's default manifest file.
@@ -898,9 +903,6 @@ public class Manifest {
             throw new BuildException("Sections must have a name");
         }
         sections.put(sectionName, section);
-        if (!sectionIndex.contains(sectionName)) {
-            sectionIndex.addElement(sectionName);
-        }
     }
 
     /**
@@ -915,7 +917,7 @@ public class Manifest {
         if (attribute.getKey() == null || attribute.getValue() == null) {
             throw new BuildException("Attributes must have name and value");
         }
-        if (attribute.getKey().equalsIgnoreCase(ATTRIBUTE_MANIFEST_VERSION)) {
+        if (attribute.getKey().equals(ATTRIBUTE_MANIFEST_VERSION_LC)) {
             manifestVersion = attribute.getValue();
         } else {
             mainSection.addConfiguredAttribute(attribute);
@@ -1041,9 +1043,9 @@ public class Manifest {
             }
         }
 
-        Enumeration e = sectionIndex.elements();
-        while (e.hasMoreElements()) {
-            String sectionName = (String) e.nextElement();
+        Iterator e = sections.keySet().iterator();
+        while (e.hasNext()) {
+            String sectionName = (String) e.next();
             Section section = getSection(sectionName);
             section.write(writer, flatten);
         }
@@ -1079,9 +1081,9 @@ public class Manifest {
         }
 
         // create a vector and add in the warnings for all the sections
-        Enumeration e = sections.elements();
-        while (e.hasMoreElements()) {
-            Section section = (Section) e.nextElement();
+        Iterator e = sections.values().iterator();
+        while (e.hasNext()) {
+            Section section = (Section) e.next();
             Enumeration e2 = section.getWarnings();
             while (e2.hasMoreElements()) {
                 warnings.addElement(e2.nextElement());
@@ -1172,6 +1174,6 @@ public class Manifest {
      * @return an Enumeration of section names
      */
     public Enumeration getSectionNames() {
-        return sectionIndex.elements();
+        return CollectionUtils.asEnumeration(sections.keySet().iterator());
     }
 }

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=939802&r1=939801&r2=939802&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 Fri Apr 30 20:28:06 2010
@@ -338,6 +338,8 @@ public class Move extends Copy {
             destFile = getFileUtils().normalize(destFile.getAbsolutePath());
             if (destFile.equals(sourceFile)) {
                 //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())) {

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java Fri Apr 30 20:28:06 2010
@@ -20,8 +20,8 @@ package org.apache.tools.ant.taskdefs;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.util.Enumeration;
-import java.util.Vector;
+import java.util.HashSet;
+import java.util.Iterator;
 
 /**
  * Destroys all registered <code>Process</code>es when the VM exits.
@@ -30,7 +30,7 @@ import java.util.Vector;
  */
 class ProcessDestroyer implements Runnable {
     private static final int THREAD_DIE_TIMEOUT = 20000;
-    private Vector processes = new Vector();
+    private HashSet processes = new HashSet();
     // methods to register and unregister shutdown hooks
     private Method addShutdownHookMethod;
     private Method removeShutdownHookMethod;
@@ -183,8 +183,7 @@ class ProcessDestroyer implements Runnab
             if (processes.size() == 0) {
                 addShutdownHook();
             }
-            processes.addElement(process);
-            return processes.contains(process);
+            return processes.add(process);
         }
     }
 
@@ -198,7 +197,7 @@ class ProcessDestroyer implements Runnab
      */
     public boolean remove(Process process) {
         synchronized (processes) {
-            boolean processRemoved = processes.removeElement(process);
+            boolean processRemoved = processes.remove(process);
             if (processRemoved && processes.size() == 0) {
                 removeShutdownHook();
             }
@@ -212,9 +211,9 @@ class ProcessDestroyer implements Runnab
     public void run() {
         synchronized (processes) {
             running = true;
-            Enumeration e = processes.elements();
-            while (e.hasMoreElements()) {
-                ((Process) e.nextElement()).destroy();
+            Iterator e = processes.iterator();
+            while (e.hasNext()) {
+                ((Process) e.next()).destroy();
             }
         }
     }

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=939802&r1=939801&r2=939802&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 Fri Apr 30 20:28:06 2010
@@ -279,7 +279,7 @@ public class Property extends Task {
      */
     public void setPrefix(String prefix) {
         this.prefix = prefix;
-        if (!prefix.endsWith(".")) {
+        if (prefix != null && !prefix.endsWith(".")) {
             this.prefix += ".";
         }
     }
@@ -542,7 +542,7 @@ public class Property extends Task {
                                 Properties props, InputStream is, boolean isXml) throws IOException {
         if (isXml) {
             // load the xml based property definition
-            // use reflection because of bwc to Java 1.3
+            // use reflection because of bwc to Java 1.4
             try {
                 Method loadXmlMethod = props.getClass().getMethod("loadFromXML",
                                                                   new Class[] {InputStream.class});
@@ -715,7 +715,8 @@ public class Property extends Task {
         new ResolvePropertyMap(
                                getProject(),
                                propertyHelper,
-                               propertyHelper.getExpanders()).resolveAllProperties(props);
+                               propertyHelper.getExpanders())
+            .resolveAllProperties(props, prefix);
     }
 
 }

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=939802&r1=939801&r2=939802&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 Fri Apr 30 20:28:06 2010
@@ -21,7 +21,6 @@ package org.apache.tools.ant.taskdefs;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import org.apache.tools.ant.taskdefs.condition.Os;
 
 /**
  * Copies standard output and error of subprocesses to standard output and
@@ -130,8 +129,6 @@ public class PumpStreamHandler implement
      * Stop pumping the streams.
      */
     public void stop() {
-        finish(outputThread);
-        finish(errorThread);
 
         if (inputPump != null) {
             inputPump.stop();
@@ -147,9 +144,11 @@ public class PumpStreamHandler implement
         } catch (IOException e) {
             // ignore
         }
+        finish(outputThread);
+        finish(errorThread);
     }
 
-    private static final long JOIN_TIMEOUT = 500;
+    private static final long JOIN_TIMEOUT = 200;
 
     /**
      * Waits for a thread to finish while trying to make it finish
@@ -161,11 +160,18 @@ public class PumpStreamHandler implement
      */
     protected final void finish(Thread t) {
         try {
-            t.join(JOIN_TIMEOUT);
             StreamPumper s = null;
             if (t instanceof ThreadWithPumper) {
                 s = ((ThreadWithPumper) t).getPumper();
             }
+            if (s != null && s.isFinished()) {
+                return;
+            }
+            if (!t.isAlive()) {
+                return;
+            }
+
+            t.join(JOIN_TIMEOUT);
             if (s != null && !s.isFinished()) {
                 s.stop();
             }
@@ -238,7 +244,7 @@ public class PumpStreamHandler implement
         final Thread result
             = new ThreadWithPumper(new StreamPumper(is, os,
                                                     closeWhenExhausted,
-                                                    Os.isFamily("windows")));
+                                                    true));
         result.setDaemon(true);
         return result;
     }

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Rmic.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Rmic.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Rmic.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Rmic.java Fri Apr 30 20:28:06 2010
@@ -705,7 +705,8 @@ public class Rmic extends MatchingTask {
                 continue;
             }
             String sourceFileName = StringUtils.removeSuffix(generatedFile,
-                                                             ".class");
+                                                             ".class")
+                + ".java";
 
             File oldFile = new File(baseDir, sourceFileName);
             if (!oldFile.exists()) {

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/SQLExec.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/SQLExec.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/SQLExec.java Fri Apr 30 20:28:06 2010
@@ -1072,7 +1072,7 @@ public class SQLExec extends JDBCTask {
             // no match
             return -1;
         } else {
-            String d = delimiter.trim().toLowerCase(Locale.US);
+            String d = delimiter.trim().toLowerCase(Locale.ENGLISH);
             if (delimiterType.equals(DelimiterType.NORMAL)) {
                 // still trying to avoid wasteful copying, see
                 // StringUtils.endsWith
@@ -1087,7 +1087,7 @@ public class SQLExec extends JDBCTask {
                 }
                 while (endIndex >= 0) {
                     if (buf.substring(bufferIndex, bufferIndex + 1)
-                        .toLowerCase(Locale.US).charAt(0)
+                        .toLowerCase(Locale.ENGLISH).charAt(0)
                         != d.charAt(endIndex)) {
                         return -1;
                     }
@@ -1096,7 +1096,7 @@ public class SQLExec extends JDBCTask {
                 }
                 return bufferIndex + 1;
             } else {
-                return currentLine.trim().toLowerCase(Locale.US).equals(d)
+                return currentLine.trim().toLowerCase(Locale.ENGLISH).equals(d)
                     ? buf.length() - currentLine.length() : -1;
             }
         }

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Tstamp.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Tstamp.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Tstamp.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Tstamp.java Fri Apr 30 20:28:06 2010
@@ -324,7 +324,7 @@ public class Tstamp extends Task {
          * @return an int value.
          */
         public int getCalendarField() {
-            String key = getValue().toLowerCase();
+            String key = getValue().toLowerCase(Locale.ENGLISH);
             Integer i = (Integer) calendarFields.get(key);
             return i.intValue();
         }

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/WaitFor.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/WaitFor.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/WaitFor.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/WaitFor.java Fri Apr 30 20:28:06 2010
@@ -19,6 +19,7 @@
 package org.apache.tools.ant.taskdefs;
 
 import java.util.HashMap;
+import java.util.Locale;
 import java.util.Map;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
@@ -259,7 +260,7 @@ public class WaitFor extends ConditionBa
          * @return a multipler (a long value)
          */
         public long getMultiplier() {
-            String key = getValue().toLowerCase();
+            String key = getValue().toLowerCase(Locale.ENGLISH);
             Long l = (Long) timeTable.get(key);
             return l.longValue();
         }

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/War.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/War.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/War.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/War.java Fri Apr 30 20:28:06 2010
@@ -20,7 +20,6 @@ package org.apache.tools.ant.taskdefs;
 
 import java.io.File;
 import java.io.IOException;
-import java.util.Locale;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.types.ZipFileSet;
@@ -61,9 +60,6 @@ public class War extends Jar {
     private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
     /** path to web.xml file */
     private static final String XML_DESCRIPTOR_PATH = "WEB-INF/web.xml";
-    /** lower case version for comparisons */
-    private static final String XML_DESCRIPTOR_PATH_LC =
-            XML_DESCRIPTOR_PATH.toLowerCase(Locale.ENGLISH);
 
     /** Constructor for the War Task. */
     public War() {
@@ -178,10 +174,9 @@ public class War extends Jar {
         // not the one specified in the "webxml" attribute - or if
         // it's being added twice, meaning the same file is specified
         // by the "webxml" attribute and in a <fileset> element.
-        String vPathLowerCase = vPath.toLowerCase(Locale.ENGLISH);
         //by default, we add the file.
         boolean addFile = true;
-        if (XML_DESCRIPTOR_PATH_LC.equals(vPathLowerCase)) {
+        if (XML_DESCRIPTOR_PATH.equalsIgnoreCase(vPath)) {
             //a web.xml file was found. See if it is a duplicate or not
             if (addedWebXmlFile != null) {
                 //a second web.xml file, so skip it

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=939802&r1=939801&r2=939802&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 Fri Apr 30 20:28:06 2010
@@ -108,10 +108,6 @@ public class XSLTProcess extends Matchin
     /** for resolving entities such as dtds */
     private XMLCatalog xmlCatalog = new XMLCatalog();
 
-    /** Name of the TRAX Liaison class */
-    private static final String TRAX_LIAISON_CLASS =
-                        "org.apache.tools.ant.taskdefs.optional.TraXLiaison";
-
     /** Utilities used for file operations */
     private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
 
@@ -525,7 +521,6 @@ public class XSLTProcess extends Matchin
 
     /**
      * Set the name of the XSL processor to use; optional, default trax.
-     * Other values are "xalan" for Xalan1
      *
      * @param processor the name of the XSL processor
      */
@@ -675,15 +670,13 @@ public class XSLTProcess extends Matchin
      * @exception Exception if the processor cannot be loaded.
      */
     private void resolveProcessor(String proc) throws Exception {
-        String classname;
         if (proc.equals(PROCESSOR_TRAX)) {
-            classname = TRAX_LIAISON_CLASS;
+            liaison = new org.apache.tools.ant.taskdefs.optional.TraXLiaison();
         } else {
             //anything else is a classname
-            classname = proc;
+            Class clazz = loadClass(proc);
+            liaison = (XSLTLiaison) clazz.newInstance();
         }
-        Class clazz = loadClass(classname);
-        liaison = (XSLTLiaison) clazz.newInstance();
     }
 
     /**
@@ -906,8 +899,7 @@ public class XSLTProcess extends Matchin
      * @return an instance of the XSLTLiason interface.
      */
     protected XSLTLiaison getLiaison() {
-        // if processor wasn't specified, see if TraX is available.  If not,
-        // default it to xalan, depending on which is in the classpath
+        // if processor wasn't specified, use TraX.
         if (liaison == null) {
             if (processor != null) {
                 try {
@@ -918,8 +910,7 @@ public class XSLTProcess extends Matchin
             } else {
                 try {
                     resolveProcessor(PROCESSOR_TRAX);
-                } catch (Throwable e1) {
-                    e1.printStackTrace();
+                } catch (Exception e1) { // should not happen
                     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=939802&r1=939801&r2=939802&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 Fri Apr 30 20:28:06 2010
@@ -1026,7 +1026,7 @@ public class Zip extends MatchingTask {
                 try {
                     is = zf.getInputStream(ze);
                     zipFile(is, zOut, prefix + name, ze.getTime(),
-                            fromArchive, mode, ze.getExtraFields());
+                            fromArchive, mode, ze.getExtraFields(true));
                 } finally {
                     doCompress = oldCompress;
                     FileUtils.close(is);
@@ -1723,7 +1723,7 @@ public class Zip extends MatchingTask {
         throws IOException {
         // fromArchive is used in subclasses overriding this method
 
-        if (entries.contains(vPath)) {
+        if (entries.containsKey(vPath)) {
 
             if (duplicate.equals("preserve")) {
                 logWhenWriting(vPath + " already added, skipping",

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=939802&r1=939801&r2=939802&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 Fri Apr 30 20:28:06 2010
@@ -101,7 +101,7 @@ public final class CompilerAdapterFactor
             if (compilerType.equalsIgnoreCase("jikes")) {
                 return new Jikes();
             }
-            if (compilerType.equalsIgnoreCase("extJavac")) {
+            if (compilerType.equalsIgnoreCase("extjavac")) {
                 return new JavacExternal();
             }
             if (compilerType.equalsIgnoreCase("classic")

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/condition/Equals.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/condition/Equals.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/condition/Equals.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/condition/Equals.java Fri Apr 30 20:28:06 2010
@@ -32,6 +32,7 @@ public class Equals implements Condition
     private boolean trim = false;
     private boolean caseSensitive = true;
     private int args;
+    private boolean forcestring = false;
 
     /**
      * Set the first argument
@@ -107,6 +108,16 @@ public class Equals implements Condition
     }
 
     /**
+     * Set whether to force string comparisons for non-equal, non-string objects.
+     * This allows object properties (legal in Ant 1.8.x+) to be compared as strings.
+     * @param forcestring value to set
+     * @since Ant 1.8.1
+     */
+    public void setForcestring(boolean forcestring) {
+        this.forcestring = forcestring;
+    }
+
+    /**
      * @return true if the two strings are equal
      * @exception BuildException if the attributes are not set correctly
      */
@@ -114,7 +125,13 @@ public class Equals implements Condition
         if ((args & REQUIRED) != REQUIRED) {
             throw new BuildException("both arg1 and arg2 are required in equals");
         }
-
+        if (arg1 == arg2 || arg1 != null && arg1.equals(arg2)) {
+            return true;
+        }
+        if (forcestring) {
+            arg1 = arg1 == null || arg1 instanceof String ? arg1 : arg1.toString();
+            arg2 = arg2 == null || arg2 instanceof String ? arg2 : arg2.toString();
+        }
         if (arg1 instanceof String && trim) {
             arg1 = ((String) arg1).trim();
         }
@@ -126,6 +143,6 @@ public class Equals implements Condition
             String s2 = (String) arg2;
             return caseSensitive ? s1.equals(s2) : s1.equalsIgnoreCase(s2);
         }
-        return arg1 == arg2 || arg1 != null && arg1.equals(arg2);
+        return false;
     }
 }

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/condition/Http.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/condition/Http.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/condition/Http.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/condition/Http.java Fri Apr 30 20:28:06 2010
@@ -70,12 +70,12 @@ public class Http extends ProjectCompone
      *               such as "GET", "HEAD", "TRACE", etc. The default
      *               if not specified is "GET".
      *
-     * @see java.net.HttpURLConnection#setRequestMethod()
+     * @see java.net.HttpURLConnection#setRequestMethod
      * @since Ant 1.8.0
      */
     public void setRequestMethod(String method) {
         this.requestMethod = method == null ? DEFAULT_REQUEST_METHOD
-            : method.toUpperCase(Locale.US);
+            : method.toUpperCase(Locale.ENGLISH);
     }
 
     /**

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/condition/Os.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/condition/Os.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/condition/Os.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/condition/Os.java Fri Apr 30 20:28:06 2010
@@ -29,11 +29,11 @@ import org.apache.tools.ant.BuildExcepti
  */
 public class Os implements Condition {
     private static final String OS_NAME =
-        System.getProperty("os.name").toLowerCase(Locale.US);
+        System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
     private static final String OS_ARCH =
-        System.getProperty("os.arch").toLowerCase(Locale.US);
+        System.getProperty("os.arch").toLowerCase(Locale.ENGLISH);
     private static final String OS_VERSION =
-        System.getProperty("os.version").toLowerCase(Locale.US);
+        System.getProperty("os.version").toLowerCase(Locale.ENGLISH);
     private static final String PATH_SEP =
         System.getProperty("path.separator");
 
@@ -142,7 +142,7 @@ public class Os implements Condition {
      *               </ul>
      */
     public void setFamily(String f) {
-        family = f.toLowerCase(Locale.US);
+        family = f.toLowerCase(Locale.ENGLISH);
     }
 
     /**
@@ -151,7 +151,7 @@ public class Os implements Condition {
      * @param name   The OS name
      */
     public void setName(String name) {
-        this.name = name.toLowerCase(Locale.US);
+        this.name = name.toLowerCase(Locale.ENGLISH);
     }
 
     /**
@@ -160,7 +160,7 @@ public class Os implements Condition {
      * @param arch   The OS architecture
      */
     public void setArch(String arch) {
-        this.arch = arch.toLowerCase(Locale.US);
+        this.arch = arch.toLowerCase(Locale.ENGLISH);
     }
 
     /**
@@ -169,7 +169,7 @@ public class Os implements Condition {
      * @param version   The OS version
      */
     public void setVersion(String version) {
-        this.version = version.toLowerCase(Locale.US);
+        this.version = version.toLowerCase(Locale.ENGLISH);
     }
 
     /**

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=939802&r1=939801&r2=939802&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 Fri Apr 30 20:28:06 2010
@@ -20,6 +20,7 @@ antstructure=org.apache.tools.ant.taskde
 antversion=org.apache.tools.ant.taskdefs.condition.AntVersion
 apply=org.apache.tools.ant.taskdefs.Transform
 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
 buildnumber=org.apache.tools.ant.taskdefs.BuildNumber
@@ -195,7 +196,6 @@ stcheckin=org.apache.tools.ant.taskdefs.
 stcheckout=org.apache.tools.ant.taskdefs.optional.starteam.StarTeamCheckout
 stlabel=org.apache.tools.ant.taskdefs.optional.starteam.StarTeamLabel
 stlist=org.apache.tools.ant.taskdefs.optional.starteam.StarTeamList
-stylebook=org.apache.tools.ant.taskdefs.optional.StyleBook
 symlink=org.apache.tools.ant.taskdefs.optional.unix.Symlink
 telnet=org.apache.tools.ant.taskdefs.optional.net.TelnetTask
 translate=org.apache.tools.ant.taskdefs.optional.i18n.Translate

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/email/Message.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/email/Message.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/email/Message.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/email/Message.java Fri Apr 30 20:28:06 2010
@@ -26,6 +26,7 @@ import java.io.OutputStreamWriter;
 import java.io.PrintStream;
 
 import org.apache.tools.ant.ProjectComponent;
+import org.apache.tools.ant.util.FileUtils;
 
 /**
  * Class representing an email message.
@@ -115,28 +116,33 @@ public class Message extends ProjectComp
          throws IOException {
         // We need character encoding aware printing here.
         // So, using BufferedWriter over OutputStreamWriter instead of PrintStream
-        BufferedWriter out
-            = charset != null ? new BufferedWriter(new OutputStreamWriter(ps, charset))
-                              : new BufferedWriter(new OutputStreamWriter(ps));
-        if (messageSource != null) {
-            // Read message from a file
-            FileReader freader = new FileReader(messageSource);
-
-            try {
-                BufferedReader in = new BufferedReader(freader);
-                String line = null;
-                while ((line = in.readLine()) != null) {
-                    out.write(getProject().replaceProperties(line));
-                    out.newLine();
+        BufferedWriter out = null;
+        try {
+            out
+                = charset != null ? new BufferedWriter(new OutputStreamWriter(ps, charset))
+                : new BufferedWriter(new OutputStreamWriter(ps));
+            if (messageSource != null) {
+                // Read message from a file
+                FileReader freader = new FileReader(messageSource);
+
+                try {
+                    BufferedReader in = new BufferedReader(freader);
+                    String line = null;
+                    while ((line = in.readLine()) != null) {
+                        out.write(getProject().replaceProperties(line));
+                        out.newLine();
+                    }
+                } finally {
+                    freader.close();
                 }
-            } finally {
-                freader.close();
+            } else {
+                out.write(getProject().replaceProperties(buffer.substring(0)));
+                out.newLine();
             }
-        } else {
-            out.write(getProject().replaceProperties(buffer.substring(0)));
-            out.newLine();
+            out.flush();
+        } finally {
+            //do not close the out writer as it is reused afterwards by the mail task
         }
-        out.flush();
     }
 
 

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java Fri Apr 30 20:28:06 2010
@@ -26,11 +26,12 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.UnsupportedEncodingException;
 
-import java.util.Vector;
+import java.util.Enumeration;
 import java.util.Iterator;
+import java.util.Locale;
 import java.util.Properties;
-import java.util.Enumeration;
 import java.util.StringTokenizer;
+import java.util.Vector;
 
 import java.security.Provider;
 import java.security.Security;
@@ -100,7 +101,7 @@ public class MimeMailer extends Mailer {
         }
 
         public void setContentType(String type) {
-            this.type = type.toLowerCase();
+            this.type = type.toLowerCase(Locale.ENGLISH);
         }
 
         public String getContentType() {

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java Fri Apr 30 20:28:06 2010
@@ -179,14 +179,18 @@ public class Cab extends MatchingTask {
         throws IOException {
         File listFile = FILE_UTILS.createTempFile("ant", "", null, true, true);
 
-        BufferedWriter writer = new BufferedWriter(new FileWriter(listFile));
-
-        int size = files.size();
-        for (int i = 0; i < size; i++) {
-            writer.write('\"' + files.elementAt(i).toString() + '\"');
-            writer.newLine();
+        BufferedWriter writer = null;
+        try {
+            writer = new BufferedWriter(new FileWriter(listFile));
+
+            int size = files.size();
+            for (int i = 0; i < size; i++) {
+                writer.write('\"' + files.elementAt(i).toString() + '\"');
+                writer.newLine();
+            }
+        } finally {
+            FileUtils.close(writer);
         }
-        writer.close();
 
         return listFile;
     }

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java Fri Apr 30 20:28:06 2010
@@ -73,6 +73,7 @@ import org.apache.tools.ant.util.FileUti
  * <li>suppressVariableNotUsed</li>
  * <li>suppressExceptionNotSignalled</li>
  * <li>suppressDeprecation</li>
+ * <li>removeKeepExtension</li>
  * </ul>
  * Of these arguments, the <b>srcdir</b> argument is required.
  *
@@ -126,6 +127,7 @@ public class NetRexxC extends MatchingTa
     private boolean suppressVariableNotUsed = false;
     private boolean suppressExceptionNotSignalled = false;
     private boolean suppressDeprecation = false;
+    private boolean removeKeepExtension = false;
 
     // constants for the messages to suppress by flags and their corresponding properties
     static final String MSG_METHOD_ARGUMENT_NOT_USED
@@ -144,6 +146,8 @@ public class NetRexxC extends MatchingTa
 
     /**
      * Set whether literals are treated as binary, rather than NetRexx types.
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+     * The default is false.
      * @param binary a <code>boolean</code> value.
      */
     public void setBinary(boolean binary) {
@@ -162,8 +166,8 @@ public class NetRexxC extends MatchingTa
 
     /**
      * Set whether comments are passed through to the generated java source.
-     * Valid true values are "on" or "true". Anything else sets the flag to
-     * false. The default value is false
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+     * The default value is false.
      * @param comments a <code>boolean</code> value.
      */
     public void setComments(boolean comments) {
@@ -172,9 +176,9 @@ public class NetRexxC extends MatchingTa
 
 
     /**
-     * Set whether error messages come out in compact or verbose format. Valid
-     * true values are "on" or "true". Anything else sets the flag to false.
-     * The default value is false
+     * Set whether error messages come out in compact or verbose format.
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+     * The default value is true.
      * @param compact a <code>boolean</code> value.
      */
     public void setCompact(boolean compact) {
@@ -183,10 +187,10 @@ public class NetRexxC extends MatchingTa
 
 
     /**
-     * Set whether the NetRexx compiler should compile the generated java code
-     * Valid true values are "on" or "true". Anything else sets the flag to
-     * false. The default value is true. Setting this flag to false, will
-     * automatically set the keep flag to true.
+     * Set whether the NetRexx compiler should compile the generated java code.
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+     * The default value is true.
+     * Setting this flag to false, will automatically set the keep flag to true.
      * @param compile a <code>boolean</code> value.
      */
     public void setCompile(boolean compile) {
@@ -198,9 +202,10 @@ public class NetRexxC extends MatchingTa
 
 
     /**
-     * Set whether or not messages should be displayed on the 'console' Valid
-     * true values are "on" or "true". Anything else sets the flag to false.
-     * The default value is true.
+     * Set whether or not compiler messages should be displayed on the 'console'.
+     * Note that this task will rely on the default value for filtering compile messages.
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+     * The default value is false.
      * @param console a <code>boolean</code> value.
      */
     public void setConsole(boolean console) {
@@ -210,6 +215,8 @@ public class NetRexxC extends MatchingTa
 
     /**
      * Whether variable cross references are generated.
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+     * The default value is false.
      * @param crossref a <code>boolean</code> value.
      */
     public void setCrossref(boolean crossref) {
@@ -219,9 +226,10 @@ public class NetRexxC extends MatchingTa
 
     /**
      * Set whether decimal arithmetic should be used for the netrexx code.
-     * Binary arithmetic is used when this flag is turned off. Valid true
-     * values are "on" or "true". Anything else sets the flag to false. The
-     * default value is true.
+     * Setting this to off will report decimal arithmetic as an error, for
+     * performance critical applications.
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+     * The default value is true.
      * @param decimal a <code>boolean</code> value.
      */
     public void setDecimal(boolean decimal) {
@@ -249,8 +257,8 @@ public class NetRexxC extends MatchingTa
 
 
     /**
-     * Sets whether variables must be declared explicitly before use. Valid
-     * true values are "on" or "true". Anything else sets the flag to false.
+     * Sets whether variables must be declared explicitly before use.
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
      * The default value is false.
      * @param explicit a <code>boolean</code> value.
      */
@@ -262,6 +270,8 @@ public class NetRexxC extends MatchingTa
     /**
      * Whether the generated java code is formatted nicely or left to match
      * NetRexx line numbers for call stack debugging.
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+     * The default value false.
      * @param format a <code>boolean</code> value.
      */
     public void setFormat(boolean format) {
@@ -270,9 +280,8 @@ public class NetRexxC extends MatchingTa
 
 
     /**
-     * Whether the generated java code is produced Valid true values are "on"
-     * or "true". Anything else sets the flag to false. The default value is
-     * false.
+     * Whether the generated java code is produced.
+     * This is not implemented yet.
      * @param java a <code>boolean</code> value.
      */
     public void setJava(boolean java) {
@@ -283,9 +292,11 @@ public class NetRexxC extends MatchingTa
     /**
      * Sets whether the generated java source file should be kept after
      * compilation. The generated files will have an extension of .java.keep,
-     * <b>not</b> .java Valid true values are "on" or "true". Anything else
-     * sets the flag to false. The default value is false.
+     * <b>not</b> .java. See setRemoveKeepExtension
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+     * The default value is false.
      * @param keep a <code>boolean</code> value.
+     * @see #setRemoveKeepExtension(boolean)
      */
     public void setKeep(boolean keep) {
         this.keep = keep;
@@ -294,6 +305,8 @@ public class NetRexxC extends MatchingTa
 
     /**
      * Whether the compiler text logo is displayed when compiling.
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+     * The default value is false.
      * @param logo a <code>boolean</code> value.
      */
     public void setLogo(boolean logo) {
@@ -302,9 +315,9 @@ public class NetRexxC extends MatchingTa
 
 
     /**
-     * Whether the generated .java file should be replaced when compiling
-     * Valid true values are "on" or "true". Anything else sets the flag to
-     * false. The default value is false.
+     * Whether the generated .java file should be replaced when compiling.
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+     * The default value is false.
      * @param replace a <code>boolean</code> value.
      */
     public void setReplace(boolean replace) {
@@ -314,8 +327,9 @@ public class NetRexxC extends MatchingTa
 
     /**
      * Sets whether the compiler messages will be written to NetRexxC.log as
-     * well as to the console Valid true values are "on" or "true". Anything
-     * else sets the flag to false. The default value is false.
+     * well as to the console.
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+     * The default value is false.
      * @param savelog a <code>boolean</code> value.
      */
     public void setSavelog(boolean savelog) {
@@ -325,9 +339,9 @@ public class NetRexxC extends MatchingTa
 
     /**
      * Tells the NetRexx compiler to store the class files in the same
-     * directory as the source files. The alternative is the working directory
-     * Valid true values are "on" or "true". Anything else sets the flag to
-     * false. The default value is true.
+     * directory as the source files. The alternative is the working directory.
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+     * The default value is true.
      * @param sourcedir a <code>boolean</code> value.
      */
     public void setSourcedir(boolean sourcedir) {
@@ -347,9 +361,9 @@ public class NetRexxC extends MatchingTa
     /**
      * Tells the NetRexx compiler that method calls always need parentheses,
      * even if no arguments are needed, e.g. <code>aStringVar.getBytes</code>
-     * vs. <code>aStringVar.getBytes()</code> Valid true values are "on" or
-     * "true". Anything else sets the flag to false. The default value is
-     * false.
+     * vs. <code>aStringVar.getBytes()</code>.
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+     * The default value is false.
      * @param strictargs a <code>boolean</code> value.
      */
     public void setStrictargs(boolean strictargs) {
@@ -359,6 +373,8 @@ public class NetRexxC extends MatchingTa
 
     /**
      * Tells the NetRexx compile that assignments must match exactly on type.
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+     * The default value is false.
      * @param strictassign a <code>boolean</code> value.
      */
     public void setStrictassign(boolean strictassign) {
@@ -368,6 +384,8 @@ public class NetRexxC extends MatchingTa
 
     /**
      * Specifies whether the NetRexx compiler should be case sensitive or not.
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+     * The default value is false.
      * @param strictcase a <code>boolean</code> value.
      */
     public void setStrictcase(boolean strictcase) {
@@ -378,8 +396,9 @@ public class NetRexxC extends MatchingTa
     /**
      * Sets whether classes need to be imported explicitly using an <code>import</code>
      * statement. By default the NetRexx compiler will import certain packages
-     * automatically Valid true values are "on" or "true". Anything else sets
-     * the flag to false. The default value is false.
+     * automatically.
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+     * The default value is false.
      * @param strictimport a <code>boolean</code> value.
      */
     public void setStrictimport(boolean strictimport) {
@@ -389,8 +408,9 @@ public class NetRexxC extends MatchingTa
 
     /**
      * Sets whether local properties need to be qualified explicitly using
-     * <code>this</code> Valid true values are "on" or "true". Anything else
-     * sets the flag to false. The default value is false.
+     * <code>this</code>.
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+     * The default value is false.
      * @param strictprops a <code>boolean</code> value.
      */
     public void setStrictprops(boolean strictprops) {
@@ -401,6 +421,8 @@ public class NetRexxC extends MatchingTa
     /**
      * Whether the compiler should force catching of exceptions by explicitly
      * named types.
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+     * The default value is false
      * @param strictsignal a <code>boolean</code> value.
      */
     public void setStrictsignal(boolean strictsignal) {
@@ -409,9 +431,9 @@ public class NetRexxC extends MatchingTa
 
 
     /**
-     * Sets whether debug symbols should be generated into the class file
-     * Valid true values are "on" or "true". Anything else sets the flag to
-     * false. The default value is false.
+     * Sets whether debug symbols should be generated into the class file.
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+     * The default value is false.
      * @param symbols a <code>boolean</code> value.
      */
     public void setSymbols(boolean symbols) {
@@ -421,8 +443,8 @@ public class NetRexxC extends MatchingTa
 
     /**
      * Asks the NetRexx compiler to print compilation times to the console
-     * Valid true values are "on" or "true". Anything else sets the flag to
-     * false. The default value is false.
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+     * The default value is false.
      * @param time a <code>boolean</code> value.
      */
     public void setTime(boolean time) {
@@ -454,9 +476,9 @@ public class NetRexxC extends MatchingTa
 
 
     /**
-     * Tells the NetRexx compiler that the source is in UTF8 Valid true values
-     * are "on" or "true". Anything else sets the flag to false. The default
-     * value is false.
+     * Tells the NetRexx compiler that the source is in UTF8.
+     * Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
+     * The default value is false.
      * @param utf8 a <code>boolean</code> value.
      */
     public void setUtf8(boolean utf8) {
@@ -539,6 +561,16 @@ public class NetRexxC extends MatchingTa
 
 
     /**
+     * Tells wether the trailing .keep in nocompile-mode should be removed
+     * so that the resulting java source really ends on .java.
+     * This facilitates the use of the javadoc tool lateron.
+     */
+    public void setRemoveKeepExtension(boolean removeKeepExtension) {
+        this.removeKeepExtension = removeKeepExtension;
+    }
+
+
+    /**
      * init-Method sets defaults from Properties. That way, when ant is called
      * with arguments like -Dant.netrexxc.verbose=verbose5 one can easily take
      * control of all netrexxc-tasks.
@@ -642,6 +674,9 @@ public class NetRexxC extends MatchingTa
         if ((p = getProject().getProperty("ant.netrexxc.suppressDeprecation")) != null) {
             this.suppressDeprecation = Project.toBoolean(p);
         }
+        if ((p = getProject().getProperty("ant.netrexxc.removeKeepExtension")) != null) {
+            this.removeKeepExtension = Project.toBoolean(p);
+        }
     }
 
 
@@ -674,6 +709,9 @@ public class NetRexxC extends MatchingTa
                  + (compileList.size() == 1 ? "" : "s")
                  + " to " + destDir);
             doNetRexxCompile();
+            if (removeKeepExtension && (!compile || keep)) {
+                removeKeepExtensions();
+            }
         }
     }
 
@@ -695,8 +733,18 @@ public class NetRexxC extends MatchingTa
                 File classFile =
                     new File(destDir,
                     filename.substring(0, filename.lastIndexOf('.')) + ".class");
+                File javaFile =
+                    new File(destDir,
+                    filename.substring(0, filename.lastIndexOf('.'))
+                    + (removeKeepExtension ? ".java" : ".java.keep"));
 
-                if (!compile || srcFile.lastModified() > classFile.lastModified()) {
+                // nocompile case tests against .java[.keep] file
+                if (!compile && srcFile.lastModified() > javaFile.lastModified()) {
+                    filecopyList.put(srcFile.getAbsolutePath(), destFile.getAbsolutePath());
+                    compileList.addElement(destFile.getAbsolutePath());
+                }
+                // compile case tests against .class file
+                else if (compile && srcFile.lastModified() > classFile.lastModified()) {
                     filecopyList.put(srcFile.getAbsolutePath(), destFile.getAbsolutePath());
                     compileList.addElement(destFile.getAbsolutePath());
                 }
@@ -735,6 +783,30 @@ public class NetRexxC extends MatchingTa
     }
 
 
+    /**
+     * Rename .java.keep files (back) to .java. The netrexxc renames all
+     * .java files to .java.keep if either -keep or -nocompile option is set.
+     */
+    private void removeKeepExtensions() {
+        if (compileList.size() > 0) {
+            log("Removing .keep extension on " + compileList.size() + " file"
+                 + (compileList.size() == 1 ? "" : "s"));
+            Enumeration e = compileList.elements();
+            while (e.hasMoreElements()) {
+                String nrxName = (String) e.nextElement();
+                String baseName = nrxName.substring(0, nrxName.lastIndexOf('.'));
+                File fromFile = new File(baseName + ".java.keep");
+                File toFile = new File(baseName + ".java");
+                if (fromFile.renameTo(toFile)) {
+                    log("Successfully renamed " + fromFile + " to " + toFile, Project.MSG_VERBOSE);
+                } else {
+                    log("Failed to rename " + fromFile + " to " + toFile);
+                }
+            }
+        }
+    }
+
+
     /** Performs a compile using the NetRexx 1.1.x compiler  */
     private void doNetRexxCompile() throws BuildException {
         log("Using NetRexx compiler", Project.MSG_VERBOSE);

Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java Fri Apr 30 20:28:06 2010
@@ -354,6 +354,7 @@ public class ReplaceRegExp extends Task 
 
         Reader r = null;
         Writer w = null;
+        BufferedWriter bw = null;
 
         try {
             if (encoding == null) {
@@ -366,7 +367,7 @@ public class ReplaceRegExp extends Task 
             }
 
             BufferedReader br = new BufferedReader(r);
-            BufferedWriter bw = new BufferedWriter(w);
+            bw = new BufferedWriter(w);
 
             boolean changes = false;
 
@@ -447,7 +448,6 @@ public class ReplaceRegExp extends Task 
                     }
                 } while (c >= 0);
 
-                bw.flush();
             } else {
                 String buf = FileUtils.safeReadFully(br);
 
@@ -458,9 +458,10 @@ public class ReplaceRegExp extends Task 
                 }
 
                 bw.write(res);
-                bw.flush();
             }
 
+            bw.flush();
+
             r.close();
             r = null;
             w.close();
@@ -484,6 +485,7 @@ public class ReplaceRegExp extends Task 
             }
         } finally {
             FileUtils.close(r);
+            FileUtils.close(bw);
             FileUtils.close(w);
             if (temp != null) {
                 temp.delete();