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 [3/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/etc/poms/ant-jmf/pom.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/etc/poms/ant-jmf/pom.xml?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/etc/poms/ant-jmf/pom.xml (original)
+++ ant/core/branches/ANT_SITE/src/etc/poms/ant-jmf/pom.xml Fri Apr 30 20:28:06 2010
@@ -57,7 +57,7 @@ xsi:schemaLocation="http://maven.apache.
<source>1.4</source>
<target>1.4</target>
<includes>
- <include>org/apache/tools/ant//taskdefs/optional/sound/*</include>
+ <include>org/apache/tools/ant/taskdefs/optional/sound/*</include>
</includes>
</configuration>
</plugin>
Modified: ant/core/branches/ANT_SITE/src/etc/poms/ant-jsch/pom.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/etc/poms/ant-jsch/pom.xml?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/etc/poms/ant-jsch/pom.xml (original)
+++ ant/core/branches/ANT_SITE/src/etc/poms/ant-jsch/pom.xml Fri Apr 30 20:28:06 2010
@@ -57,7 +57,7 @@ xsi:schemaLocation="http://maven.apache.
<source>1.4</source>
<target>1.4</target>
<includes>
- <include>org/apache/tools/ant//taskdefs/optional/ssh/*</include>
+ <include>org/apache/tools/ant/taskdefs/optional/ssh/*</include>
</includes>
</configuration>
</plugin>
Modified: ant/core/branches/ANT_SITE/src/etc/poms/ant-junit/pom.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/etc/poms/ant-junit/pom.xml?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/etc/poms/ant-junit/pom.xml (original)
+++ ant/core/branches/ANT_SITE/src/etc/poms/ant-junit/pom.xml Fri Apr 30 20:28:06 2010
@@ -80,7 +80,7 @@ xsi:schemaLocation="http://maven.apache.
<source>1.4</source>
<target>1.4</target>
<includes>
- <include>org/apache/tools/ant//taskdefs/optional/junit/*</include>
+ <include>org/apache/tools/ant/taskdefs/optional/junit/*</include>
</includes>
</configuration>
</plugin>
Modified: ant/core/branches/ANT_SITE/src/etc/poms/ant-netrexx/pom.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/etc/poms/ant-netrexx/pom.xml?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/etc/poms/ant-netrexx/pom.xml (original)
+++ ant/core/branches/ANT_SITE/src/etc/poms/ant-netrexx/pom.xml Fri Apr 30 20:28:06 2010
@@ -57,7 +57,7 @@ xsi:schemaLocation="http://maven.apache.
<source>1.4</source>
<target>1.4</target>
<includes>
- <include>org/apache/tools/ant//taskdefs/optional/NetRexxC*</include>
+ <include>org/apache/tools/ant/taskdefs/optional/NetRexxC*</include>
</includes>
</configuration>
</plugin>
Modified: ant/core/branches/ANT_SITE/src/etc/poms/ant-nodeps/pom.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/etc/poms/ant-nodeps/pom.xml?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/etc/poms/ant-nodeps/pom.xml (original)
+++ ant/core/branches/ANT_SITE/src/etc/poms/ant-nodeps/pom.xml Fri Apr 30 20:28:06 2010
@@ -41,28 +41,6 @@
<version>1.8.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
- <dependency>
- <!-- the implementation jar of the xerces jar will be used by ant to parse
- XML files, particularly the build files, if the JDK does not provide a parser
- xercesImpl.jar is provided with ant -->
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- <version>2.9.0</version>
- <optional>true</optional>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <!-- xml-apis contains the org.w3c.dom package
- since ant is using DOM APIS to parse the XML build file and do other XML related activities
- xml-apis is a compile time dependency
- a version of xml-apis.jar is delivered with ant -->
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- <version>1.3.04</version>
- <optional>true</optional>
- <scope>compile</scope>
- </dependency>
-
</dependencies>
<build>
<plugins>
@@ -81,7 +59,6 @@
<include>org/apache/tools/ant/util/regexp/Jdk14Regexp*</include>
</includes>
<excludes>
- <exclude>org/apache/tools/ant/taskdefs/optional/TraXLiaison*</exclude>
<exclude>org/apache/tools/ant/taskdefs/optional/Xalan2TraceSupport*</exclude>
<exclude>org/apache/tools/ant/taskdefs/optional/junit/**</exclude>
<exclude>org/apache/tools/ant/taskdefs/optional/perforce/**</exclude>
Modified: ant/core/branches/ANT_SITE/src/etc/poms/ant-swing/pom.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/etc/poms/ant-swing/pom.xml?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/etc/poms/ant-swing/pom.xml (original)
+++ ant/core/branches/ANT_SITE/src/etc/poms/ant-swing/pom.xml Fri Apr 30 20:28:06 2010
@@ -51,7 +51,7 @@
<source>1.4</source>
<target>1.4</target>
<includes>
- <include>org/apache/tools/ant//taskdefs/optional/splash/*</include>
+ <include>org/apache/tools/ant/taskdefs/optional/splash/*</include>
</includes>
</configuration>
</plugin>
Modified: ant/core/branches/ANT_SITE/src/etc/poms/ant/pom.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/etc/poms/ant/pom.xml?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/etc/poms/ant/pom.xml (original)
+++ ant/core/branches/ANT_SITE/src/etc/poms/ant/pom.xml Fri Apr 30 20:28:06 2010
@@ -42,27 +42,6 @@
<version>1.8.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
- <dependency>
- <!-- the implementation jar of the xerces jar will be used by ant to parse
- XML files, particularly the build files, if the JDK does not provide a parser
- xercesImpl.jar is provided with ant -->
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- <version>2.9.0</version>
- <optional>true</optional>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <!-- xml-apis contains the org.w3c.dom package
- since ant is using DOM APIS to parse the XML build file and do other XML related activities
- xml-apis is a compile time dependency
- a version of xml-apis.jar is delivered with ant -->
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- <version>1.3.04</version>
- <optional>true</optional>
- <scope>compile</scope>
- </dependency>
</dependencies>
<build>
<filters>
Modified: ant/core/branches/ANT_SITE/src/etc/poms/pom.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/etc/poms/pom.xml?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/etc/poms/pom.xml (original)
+++ ant/core/branches/ANT_SITE/src/etc/poms/pom.xml Fri Apr 30 20:28:06 2010
@@ -90,7 +90,6 @@ xsi:schemaLocation="http://maven.apache.
<module>ant-nodeps</module>
<module>ant-swing</module>
<module>ant-testutil</module>
- <module>ant-trax</module>
</modules>
<dependencies>
<dependency>
Modified: ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/conditions/antversion.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/conditions/antversion.xml?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/conditions/antversion.xml (original)
+++ ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/conditions/antversion.xml Fri Apr 30 20:28:06 2010
@@ -32,10 +32,10 @@
<fail>
<condition>
<not>
- <antversion exactly="1.8.0" />
+ <antversion exactly="1.8.1" />
</not>
</condition>
- Should be exactly 1.8.0
+ Should be exactly 1.8.1
</fail>
</target>
@@ -63,4 +63,4 @@
Should be exactly 1.9.0
</fail>
</target>
-</project>
\ No newline at end of file
+</project>
Modified: ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/exec/exec.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/exec/exec.xml?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/exec/exec.xml (original)
+++ ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/exec/exec.xml Fri Apr 30 20:28:06 2010
@@ -32,26 +32,6 @@
<isset property="sh.exe.executable"/>
</or>
</condition>
- <!-- UNIX -->
- <available file="wc" filepath="${env.PATH}" property="wc.executable"/>
- <!-- CYGWIN -->
- <available file="wc.exe" filepath="${env.PATH}" property="wc.exe.executable"/>
- <condition property="wc.can.run">
- <or>
- <isset property="wc.executable"/>
- <isset property="wc.exe.executable"/>
- </or>
- </condition>
- <!-- UNIX -->
- <available file="cat" filepath="${env.PATH}" property="cat.executable"/>
- <!-- CYGWIN -->
- <available file="cat.exe" filepath="${env.PATH}" property="cat.exe.executable"/>
- <condition property="cat.can.run">
- <or>
- <isset property="cat.executable"/>
- <isset property="cat.exe.executable"/>
- </or>
- </condition>
</target>
<target name="spawn" depends="init" if="test.can.run">
@@ -62,324 +42,7 @@
</exec>
</target>
- <target name="no-redirect" depends="init" if="test.can.run">
- <exec executable="sh">
- <arg value="parrot.sh"/>
- <arg value="${ant.file}" />
- </exec>
- </target>
-
- <target name="redirect1" depends="init" if="test.can.run">
- <exec executable="sh" output="redirect.out">
- <arg value="parrot.sh"/>
- <arg value="${ant.file}" />
- </exec>
- </target>
-
- <target name="redirect2" depends="init" if="test.can.run">
- <exec executable="sh" output="redirect.out" error="redirect.err">
- <arg value="parrot.sh"/>
- <arg value="${ant.file}" />
- </exec>
- </target>
-
- <target name="redirect3" depends="init" if="test.can.run">
- <exec executable="sh" logerror="true"
- output="redirect.out" outputproperty="redirect.out">
- <arg value="parrot.sh"/>
- <arg value="${ant.file}" />
- </exec>
- </target>
-
- <target name="redirect4" depends="init" if="test.can.run">
- <exec executable="sh"
- error="redirect.err" errorproperty="redirect.err"
- output="redirect.out" outputproperty="redirect.out">
- <arg value="parrot.sh"/>
- <arg value="${ant.file}" />
- </exec>
- </target>
-
- <target name="redirect5" depends="init" if="wc.can.run">
- <exec executable="wc" inputstring="x y z"
- error="redirect.err" errorproperty="redirect.err"
- output="redirect.out" outputproperty="redirect.out">
- <arg value="-w"/>
- </exec>
- </target>
-
- <target name="redirect6" depends="init" if="wc.can.run">
- <echo file="redirect.in">x y z</echo>
- <exec executable="wc" input="redirect.in"
- error="redirect.err" errorproperty="redirect.err"
- output="redirect.out" outputproperty="redirect.out">
- <arg value="-w"/>
- </exec>
- </target>
-
- <target name="redirect7" depends="init" if="wc.can.run">
- <exec executable="wc" inputstring="x y z"
- error="redirect.err"
- output="redirect.out" outputproperty="redirect.out">
- <arg value="-w"/>
- </exec>
- </target>
-
- <target name="redirector1" description="fail"
- depends="init" if="test.can.run">
- <exec executable="sh">
- <arg value="parrot.sh"/>
- <arg value="${ant.file}" />
- <redirector output="redirector.out" />
- <redirector output="whocares" />
- </exec>
- </target>
-
- <target name="redirector2" depends="init" if="test.can.run">
- <exec executable="sh">
- <arg value="parrot.sh"/>
- <arg value="${ant.file}" />
- <redirector output="redirector.out" />
- </exec>
- </target>
-
- <target name="redirector3" depends="init" if="test.can.run">
- <exec executable="sh">
- <arg value="parrot.sh"/>
- <arg value="${ant.file}" />
- <redirector output="redirector.out" error="redirector.err" />
- </exec>
- </target>
-
- <target name="redirector4" depends="init" if="test.can.run">
- <exec executable="sh">
- <arg value="parrot.sh"/>
- <arg value="${ant.file}" />
- <redirector output="redirector.out" logerror="true"
- outputproperty="redirector.out" />
- </exec>
- </target>
-
- <target name="redirector5" depends="init" if="test.can.run">
- <exec executable="sh">
- <redirector error="redirector.err" errorproperty="redirector.err"
- output="redirector.out" outputproperty="redirector.out" />
- <arg value="parrot.sh"/>
- <arg value="${ant.file}" />
- </exec>
- </target>
-
- <target name="redirector6" depends="init" if="test.can.run">
- <exec executable="sh">
- <redirector outputproperty="redirector.out"
- errorproperty="redirector.err">
- <outputmapper type="merge" to="redirector.out" />
- <errormapper type="merge" to="redirector.err" />
- </redirector>
- <arg value="parrot.sh" />
- <arg value="${ant.file}" />
- </exec>
- </target>
-
- <target name="redirector7" depends="init" if="test.can.run">
- <exec executable="sh">
- <redirector outputproperty="redirector.out"
- errorproperty="redirector.err">
- <outputmapper type="merge" to="redirector.out" />
- <errormapper type="merge" to="redirector.err" />
- <errorfilterchain>
- <replacestring from="err" to="ERROR!!!" />
- </errorfilterchain>
- </redirector>
- <arg value="parrot.sh" />
- <arg value="${ant.file}" />
- </exec>
- </target>
-
- <target name="redirector8" depends="init" if="wc.can.run">
- <echo file="redirector.in">x y z</echo>
- <exec executable="wc">
- <redirector outputproperty="redirector.out"
- errorproperty="redirector.err">
- <inputmapper type="merge" to="redirector.in" />
- <outputmapper type="merge" to="redirector.out" />
- <errormapper type="merge" to="redirector.err" />
- </redirector>
- <arg value="-w"/>
- </exec>
- </target>
-
- <target name="redirector9" depends="init" if="cat.can.run">
- <echo file="redirector.in">blah before blah</echo>
- <exec executable="cat">
- <redirector outputproperty="redirector.out"
- errorproperty="redirector.err">
- <inputfilterchain>
- <replacestring from="before" to="after" />
- </inputfilterchain>
- <inputmapper type="merge" to="redirector.in" />
- <outputmapper type="merge" to="redirector.out" />
- <errormapper type="merge" to="redirector.err" />
- </redirector>
- </exec>
- </target>
-
- <target name="redirector10" depends="init" if="cat.can.run">
- <echo file="redirector.in">blah before blah</echo>
- <exec executable="cat">
- <redirector outputproperty="redirector.out"
- errorproperty="redirector.err">
- <outputfilterchain>
- <replacestring from="before" to="after" />
- </outputfilterchain>
- <outputmapper type="merge" to="redirector.out" />
- <errormapper type="merge" to="redirector.err" />
- </redirector>
- <arg value="redirector.in"/>
- </exec>
- </target>
-
- <target name="redirector11" depends="init" if="cat.can.run">
- <exec executable="cat">
- <redirector outputproperty="redirector.out"
- errorproperty="redirector.err"
- inputstring="blah before blah">
- <inputfilterchain>
- <replacestring from="before" to="after" />
- </inputfilterchain>
- <outputmapper type="merge" to="redirector.out" />
- <errormapper type="merge" to="redirector.err" />
- </redirector>
- </exec>
- </target>
-
- <target name="redirector12" depends="init" if="cat.can.run">
- <echo file="redirector.in">blah before blah</echo>
- <exec executable="cat" output="redirector.out" error="redirector.err">
- <redirector outputproperty="redirector.out"
- errorproperty="redirector.err">
- <outputfilterchain>
- <replacestring from="before" to="after" />
- </outputfilterchain>
- <outputmapper type="glob" from="nomatch" to="nomatchout" />
- <errormapper type="glob" from="nomatch" to="nomatcherr" />
- </redirector>
- <arg value="redirector.in"/>
- </exec>
- </target>
-
- <target name="redirector13" depends="init" if="test.can.run">
- <exec executable="sh">
- <redirector>
- <outputfilterchain>
- <replacestring from="out" to="OUTPUT???" />
- </outputfilterchain>
- <errorfilterchain>
- <replacestring from="err" to="ERROR!!!" />
- </errorfilterchain>
- </redirector>
- <arg value="parrot.sh" />
- <arg value="${ant.file}" />
- </exec>
- </target>
-
- <target name="redirector14" depends="init" if="cat.can.run">
- <exec executable="cat">
- <redirector inputstring="blah before blah">
- <outputfilterchain>
- <replacestring from="before" to="after" />
- </outputfilterchain>
- <outputmapper type="glob" from="nomatch" to="nomatchout" />
- <errormapper type="glob" from="nomatch" to="nomatcherr" />
- </redirector>
- </exec>
- </target>
-
- <target name="redirector15" depends="init" if="cat.can.run">
- <exec executable="cat">
- <redirector input="input/iso8859-1" output="redirector.out"
- inputencoding="ISO8859_1" outputencoding="UTF8" />
- </exec>
- </target>
-
- <target name="redirector16" depends="init" if="test.can.run">
- <exec executable="sh">
- <redirector inputstring="exit"
- output="redirector16.out" error="redirector16.err" />
- </exec>
- <condition property="16pass">
- <and>
- <available file="redirector16.out" type="file" />
- <available file="redirector16.err" type="file" />
- </and>
- </condition>
- <fail unless="16pass">Files were not created.</fail>
- </target>
-
- <target name="redirector17" depends="init" if="test.can.run">
- <exec executable="sh">
- <redirector inputstring="exit" createemptyfiles="false"
- output="redirector17.out" error="redirector17.err" />
- </exec>
- <condition property="17fail">
- <or>
- <available file="redirector17.out" type="file" />
- <available file="redirector17.err" type="file" />
- </or>
- </condition>
- <fail if="17fail">Files were created.</fail>
- </target>
-
- <target name="redirector18" depends="init" if="test.can.run">
- <exec executable="sh">
- <arg value="parrot.sh"/>
- <arg value="${ant.file}" />
- <redirector alwayslog="true" logerror="true"
- outputproperty="redirector.out" />
- </exec>
- <fail message="property redirector.out has unexpected content">
- <condition>
- <not>
- <equals arg1="${ant.file} out" arg2="${redirector.out}" />
- </not>
- </condition>
- </fail>
- </target>
-
- <!-- test will succeed as the OS wont match-->
- <target name="testExecUnknownOS">
- <exec executable="nonexistent-program-we-expect"
- failonerror="true"
- os="ZX81">
- </exec>
- </target>
-
- <target name="testExecOSFamily">
- <exec executable="uptime"
- failonerror="true"
- osFamily="unix">
- </exec>
- <exec executable="cmd.exe"
- failonerror="true"
- osFamily="winnt">
- <arg value="/c" />
- <arg value="time /t" />
- </exec>
- </target>
-
- <target name="testExecInconsistentSettings">
- <exec executable="nonexistent-program-we-expect"
- failonerror="true"
- osFamily="WIN9X"
- os="linux unix">
- </exec>
- </target>
-
<target name="cleanup">
- <delete>
- <fileset file="${logFile}" />
- <fileset dir="${basedir}" includes="redirect*" />
- <fileset dir="${basedir}" includes="redirector*" />
- </delete>
+ <delete file="${logFile}" />
</target>
</project>
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/AntClassLoader.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/AntClassLoader.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/AntClassLoader.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/AntClassLoader.java Fri Apr 30 20:28:06 2010
@@ -22,8 +22,6 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
import java.lang.reflect.Constructor;
import java.net.MalformedURLException;
import java.net.URL;
@@ -37,14 +35,11 @@ import java.util.Hashtable;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.Vector;
-import java.util.Locale;
import java.util.jar.Attributes;
import java.util.jar.Attributes.Name;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.util.CollectionUtils;
import org.apache.tools.ant.util.FileUtils;
@@ -213,9 +208,9 @@ public class AntClassLoader extends Clas
private ClassLoader parent = null;
/**
- * A hashtable of zip files opened by the classloader (File to ZipFile).
+ * A hashtable of zip files opened by the classloader (File to JarFile).
*/
- private Hashtable zipFiles = new Hashtable();
+ private Hashtable jarFiles = new Hashtable();
/** Static map of jar file/time to manifest class-path entries */
private static Map/*<String,String>*/ pathMap = Collections.synchronizedMap(new HashMap());
@@ -488,23 +483,16 @@ public class AntClassLoader extends Clas
+ pathComponent.lastModified() + "-" + pathComponent.length();
String classpath = (String) pathMap.get(absPathPlusTimeAndLength);
if (classpath == null) {
- ZipFile jarFile = null;
- InputStream manifestStream = null;
+ JarFile jarFile = null;
try {
- jarFile = new ZipFile(pathComponent);
- manifestStream = jarFile.getInputStream(new ZipEntry("META-INF/MANIFEST.MF"));
-
- if (manifestStream == null) {
+ jarFile = new JarFile(pathComponent);
+ Manifest manifest = jarFile.getManifest();
+ if (manifest == null) {
return;
}
- Reader manifestReader = new InputStreamReader(manifestStream, "UTF-8");
- org.apache.tools.ant.taskdefs.Manifest manifest
- = new org.apache.tools.ant.taskdefs.Manifest(manifestReader);
- classpath = manifest.getMainSection().getAttributeValue("Class-Path");
- } catch (org.apache.tools.ant.taskdefs.ManifestException e) {
- // ignore
+ classpath = manifest.getMainAttributes()
+ .getValue(Attributes.Name.CLASS_PATH);
} finally {
- FileUtils.close(manifestStream);
if (jarFile != null) {
jarFile.close();
}
@@ -783,27 +771,27 @@ public class AntClassLoader extends Clas
*/
private InputStream getResourceStream(File file, String resourceName) {
try {
- ZipFile zipFile = (ZipFile) zipFiles.get(file);
- if (zipFile == null && file.isDirectory()) {
+ JarFile jarFile = (JarFile) jarFiles.get(file);
+ if (jarFile == null && file.isDirectory()) {
File resource = new File(file, resourceName);
if (resource.exists()) {
return new FileInputStream(resource);
}
} else {
- if (zipFile == null) {
+ if (jarFile == null) {
if (file.exists()) {
- zipFile = new ZipFile(file);
- zipFiles.put(file, zipFile);
+ jarFile = new JarFile(file);
+ jarFiles.put(file, jarFile);
} else {
return null;
}
//to eliminate a race condition, retrieve the entry
//that is in the hash table under that filename
- zipFile = (ZipFile) zipFiles.get(file);
+ jarFile = (JarFile) jarFiles.get(file);
}
- ZipEntry entry = zipFile.getEntry(resourceName);
+ JarEntry entry = jarFile.getJarEntry(resourceName);
if (entry != null) {
- return zipFile.getInputStream(entry);
+ return jarFile.getInputStream(entry);
}
}
} catch (Exception e) {
@@ -997,8 +985,8 @@ public class AntClassLoader extends Clas
*/
protected URL getResourceURL(File file, String resourceName) {
try {
- ZipFile zipFile = (ZipFile) zipFiles.get(file);
- if (zipFile == null && file.isDirectory()) {
+ JarFile jarFile = (JarFile) jarFiles.get(file);
+ if (jarFile == null && file.isDirectory()) {
File resource = new File(file, resourceName);
if (resource.exists()) {
@@ -1009,15 +997,17 @@ public class AntClassLoader extends Clas
}
}
} else {
- if (zipFile == null) {
+ if (jarFile == null) {
if (file.exists()) {
- zipFile = new ZipFile(file);
- zipFiles.put(file, zipFile);
+ jarFile = new JarFile(file);
+ jarFiles.put(file, jarFile);
} else {
return null;
}
+ // potential race-condition
+ jarFile = (JarFile) jarFiles.get(file);
}
- ZipEntry entry = zipFile.getEntry(resourceName);
+ JarEntry entry = jarFile.getJarEntry(resourceName);
if (entry != null) {
try {
return new URL("jar:" + FILE_UTILS.getFileURL(file) + "!/" + entry);
@@ -1180,15 +1170,11 @@ public class AntClassLoader extends Clas
if (container.isDirectory()) {
return null;
}
- JarFile jarFile = null;
- try {
- jarFile = new JarFile(container);
- return jarFile.getManifest();
- } finally {
- if (jarFile != null) {
- jarFile.close();
- }
+ JarFile jarFile = (JarFile) jarFiles.get(container);
+ if (jarFile == null) {
+ return null;
}
+ return jarFile.getManifest();
}
/**
@@ -1207,23 +1193,12 @@ public class AntClassLoader extends Clas
if (container.isDirectory()) {
return null;
}
- JarFile jarFile = null;
- InputStream is = null;
- try {
- jarFile = new JarFile(container);
- JarEntry ent = jarFile.getJarEntry(entry);
- if (ent != null) {
- // must read the input in order to obtain certificates
- is = jarFile.getInputStream(ent);
- while (is.read() >= 0);
- }
- return ent == null ? null : ent.getCertificates();
- } finally {
- FileUtils.close(is);
- if (jarFile != null) {
- jarFile.close();
- }
+ JarFile jarFile = (JarFile) jarFiles.get(container);
+ if (jarFile == null) {
+ return null;
}
+ JarEntry ent = jarFile.getJarEntry(entry);
+ return ent == null ? null : ent.getCertificates();
}
/**
@@ -1280,7 +1255,7 @@ public class AntClassLoader extends Clas
sealedString = mainAttributes.getValue(Name.SEALED);
}
}
- if (sealedString != null && sealedString.toLowerCase(Locale.ENGLISH).equals("true")) {
+ if (sealedString != null && sealedString.equalsIgnoreCase("true")) {
try {
sealBase = new URL(FileUtils.getFileUtils().toURI(container.getAbsolutePath()));
} catch (MalformedURLException e) {
@@ -1413,15 +1388,15 @@ public class AntClassLoader extends Clas
* files are closed.
*/
public synchronized void cleanup() {
- for (Enumeration e = zipFiles.elements(); e.hasMoreElements();) {
- ZipFile zipFile = (ZipFile) e.nextElement();
+ for (Enumeration e = jarFiles.elements(); e.hasMoreElements();) {
+ JarFile jarFile = (JarFile) e.nextElement();
try {
- zipFile.close();
+ jarFile.close();
} catch (IOException ioe) {
// ignore
}
}
- zipFiles = new Hashtable();
+ jarFiles = new Hashtable();
if (project != null) {
project.removeBuildListener(this);
}
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/AntTypeDefinition.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/AntTypeDefinition.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/AntTypeDefinition.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/AntTypeDefinition.java Fri Apr 30 20:28:06 2010
@@ -146,7 +146,7 @@ public class AntTypeDefinition {
* class and the definition class is not
* assignable from the assignable class.
* @param project the current project.
- * @return the exposed class - may return null if upable to load the class
+ * @return the exposed class - may return null if unable to load the class
*/
public Class getExposedClass(Project project) {
if (adaptToClass != null) {
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/ComponentHelper.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/ComponentHelper.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/ComponentHelper.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/ComponentHelper.java Fri Apr 30 20:28:06 2010
@@ -202,7 +202,7 @@ public class ComponentHelper {
/**
* @return A deep copy of the restrictredDefinition
*/
- private Map getRestrictedDefintion() {
+ private Map getRestrictedDefinition() {
Map result = new HashMap();
synchronized (restrictedDefinitions) {
for(Iterator i = restrictedDefinitions.entrySet().iterator();
@@ -241,7 +241,7 @@ public class ComponentHelper {
synchronized (this) {
checkedNamespaces.addAll(inheritedCheckedNamespace);
}
- Map inheritedRestrictedDef = helper.getRestrictedDefintion();
+ Map inheritedRestrictedDef = helper.getRestrictedDefinition();
synchronized (restrictedDefinitions) {
restrictedDefinitions.putAll(inheritedRestrictedDef);
}
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Diagnostics.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Diagnostics.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Diagnostics.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Diagnostics.java Fri Apr 30 20:28:06 2010
@@ -180,6 +180,9 @@ public final class Diagnostics {
* @since Ant 1.8.0
*/
private static URL getClassLocation(Class clazz) {
+ if (clazz.getProtectionDomain().getCodeSource() == null) {
+ return null;
+ }
return clazz.getProtectionDomain().getCodeSource().getLocation();
}
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/DynamicElement.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/DynamicElement.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/DynamicElement.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/DynamicElement.java Fri Apr 30 20:28:06 2010
@@ -28,7 +28,7 @@ public interface DynamicElement {
/**
* Create an element with the given name
*
- * @param name the element nbame
+ * @param name the element name
* @throws BuildException when any error occurs
* @return the element created
*/
Propchange: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/ExtensionPoint.java
('svn:mergeinfo' removed)
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/IntrospectionHelper.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/IntrospectionHelper.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/IntrospectionHelper.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/IntrospectionHelper.java Fri Apr 30 20:28:06 2010
@@ -378,7 +378,7 @@ public final class IntrospectionHelper {
public void setAttribute(Project p, Object element, String attributeName,
Object value) throws BuildException {
AttributeSetter as = (AttributeSetter) attributeSetters.get(
- attributeName.toLowerCase(Locale.US));
+ attributeName.toLowerCase(Locale.ENGLISH));
if (as == null && value != null) {
if (element instanceof DynamicAttributeNS) {
DynamicAttributeNS dc = (DynamicAttributeNS) element;
@@ -391,7 +391,7 @@ public final class IntrospectionHelper {
}
if (element instanceof DynamicAttribute) {
DynamicAttribute dc = (DynamicAttribute) element;
- dc.setDynamicAttribute(attributeName.toLowerCase(Locale.US), value.toString());
+ dc.setDynamicAttribute(attributeName.toLowerCase(Locale.ENGLISH), value.toString());
return;
}
if (attributeName.indexOf(':') >= 0) {
@@ -529,7 +529,7 @@ public final class IntrospectionHelper {
}
NestedCreator nc = null;
if (uri.equals(parentUri) || uri.length() == 0) {
- nc = (NestedCreator) nestedCreators.get(name.toLowerCase(Locale.US));
+ nc = (NestedCreator) nestedCreators.get(name.toLowerCase(Locale.ENGLISH));
}
if (nc == null) {
nc = createAddTypeCreator(project, parent, elementName);
@@ -573,7 +573,7 @@ public final class IntrospectionHelper {
if (nestedElement == null && parent instanceof DynamicElement) {
DynamicElement dc = (DynamicElement) parent;
nestedElement =
- dc.createDynamicElement(localName.toLowerCase(Locale.US));
+ dc.createDynamicElement(localName.toLowerCase(Locale.ENGLISH));
}
return nestedElement;
}
@@ -740,7 +740,7 @@ public final class IntrospectionHelper {
public boolean supportsReflectElement(
String parentUri, String elementName) {
String name = ProjectHelper.extractNameFromComponentName(elementName);
- if (!nestedCreators.containsKey(name.toLowerCase(Locale.US))) {
+ if (!nestedCreators.containsKey(name.toLowerCase(Locale.ENGLISH))) {
return false;
}
String uri = ProjectHelper.extractUriFromComponentName(elementName);
@@ -781,7 +781,7 @@ public final class IntrospectionHelper {
if (elementName == null) {
return;
}
- NestedCreator ns = (NestedCreator) nestedCreators.get(elementName.toLowerCase(Locale.US));
+ NestedCreator ns = (NestedCreator) nestedCreators.get(elementName.toLowerCase(Locale.ENGLISH));
if (ns == null) {
return;
}
@@ -1274,7 +1274,7 @@ public final class IntrospectionHelper {
* @return the lower-cased method name with the prefix removed.
*/
private static String getPropertyName(String methodName, String prefix) {
- return methodName.substring(prefix.length()).toLowerCase(Locale.US);
+ return methodName.substring(prefix.length()).toLowerCase(Locale.ENGLISH);
}
/**
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Project.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Project.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Project.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Project.java Fri Apr 30 20:28:06 2010
@@ -48,6 +48,7 @@ import org.apache.tools.ant.util.Collect
import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.util.JavaEnvUtils;
import org.apache.tools.ant.util.StringUtils;
+import org.apache.tools.ant.util.VectorSet;
/**
* Central representation of an Ant project. This class defines an
@@ -425,10 +426,10 @@ public class Project implements Resource
}
/**
- * Return a copy of the list of build listeners for the project.
- *
- * @return a list of build listeners for the project
- */
+ * Return a copy of the list of build listeners for the project.
+ *
+ * @return a list of build listeners for the project
+ */
public Vector getBuildListeners() {
synchronized (listenersLock) {
Vector r = new Vector(listeners.length);
@@ -1025,6 +1026,19 @@ public class Project implements Resource
}
/**
+ * Return the current task definition map. The returned map is a
+ * copy of the "live" definitions.
+ *
+ * @return a map of from task name to implementing class
+ * (String to Class).
+ *
+ * @since Ant 1.8.1
+ */
+ public Map getCopyOfTaskDefinitions() {
+ return new HashMap(getTaskDefinitions());
+ }
+
+ /**
* Add a new datatype definition.
* Attempting to override an existing definition with an
* equivalent one (i.e. with the same classname) results in
@@ -1054,6 +1068,19 @@ public class Project implements Resource
}
/**
+ * Return the current datatype definition map. The returned
+ * map is a copy pf the "live" definitions.
+ *
+ * @return a map of from datatype name to implementing class
+ * (String to Class).
+ *
+ * @since Ant 1.8.1
+ */
+ public Map getCopyOfDataTypeDefinitions() {
+ return new HashMap(getDataTypeDefinitions());
+ }
+
+ /**
* Add a <em>new</em> target to the project.
*
* @param target The target to be added to the project.
@@ -1124,6 +1151,16 @@ public class Project implements Resource
}
/**
+ * Return the map of targets. The returned map
+ * is a copy of the "live" targets.
+ * @return a map from name to target (String to Target).
+ * @since Ant 1.8.1
+ */
+ public Map getCopyOfTargets() {
+ return new HashMap(targets);
+ }
+
+ /**
* Create a new instance of a task, adding it to a list of
* created tasks for later invalidation. This causes all tasks
* to be remembered until the containing project is removed
@@ -1763,7 +1800,7 @@ public class Project implements Resource
*/
public final Vector topoSort(String[] root, Hashtable targetTable,
boolean returnAll) throws BuildException {
- Vector ret = new Vector();
+ Vector ret = new VectorSet();
Hashtable state = new Hashtable();
Stack visiting = new Stack();
@@ -1971,6 +2008,19 @@ public class Project implements Resource
}
/**
+ * Return a map of the references in the project (String to
+ * Object). The returned hashtable is a copy of the
+ * "live" references.
+ *
+ * @return a map of the references in the project (String to Object).
+ *
+ * @since Ant 1.8.1
+ */
+ public Map getCopyOfReferences() {
+ return new HashMap(references);
+ }
+
+ /**
* Look up a reference by its key (ID).
*
* @param key The key for the desired reference.
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/ProjectHelper.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/ProjectHelper.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/ProjectHelper.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/ProjectHelper.java Fri Apr 30 20:28:06 2010
@@ -19,6 +19,8 @@ package org.apache.tools.ant;
import java.io.File;
import java.util.Hashtable;
+import java.util.LinkedList;
+import java.util.List;
import java.util.Locale;
import java.util.Vector;
@@ -89,6 +91,7 @@ public class ProjectHelper {
// that read build files using ProjectHelper ).
private Vector importStack = new Vector();
+ private List extensionStack = new LinkedList();
/**
* Import stack.
@@ -101,6 +104,18 @@ public class ProjectHelper {
return importStack;
}
+ /**
+ * Extension stack.
+ * Used to keep track of targets that extend extension points.
+ *
+ * @return a list of two element string arrays where the first
+ * element is the name of the extensionpoint and the second the
+ * name of the target
+ */
+ public List getExtensionStack() {
+ return extensionStack;
+ }
+
private final static ThreadLocal targetPrefix = new ThreadLocal() {
protected Object initialValue() {
return (String) null;
@@ -213,7 +228,7 @@ public class ProjectHelper {
* Get the first project helper found in the classpath
*
* @return an project helper, never <code>null</code>
- * @see #getHelpers()
+ * @see org.apache.tools.ant.ProjectHelperRepository#getHelpers()
*/
public static ProjectHelper getProjectHelper() {
return (ProjectHelper) ProjectHelperRepository.getInstance().getHelpers().next();
@@ -261,7 +276,7 @@ public class ProjectHelper {
// reflect these into the target
String value = replaceProperties(project, attrs.getValue(i), project.getProperties());
try {
- ih.setAttribute(project, target, attrs.getName(i).toLowerCase(Locale.US), value);
+ ih.setAttribute(project, target, attrs.getName(i).toLowerCase(Locale.ENGLISH), value);
} catch (BuildException be) {
// id attribute must be set externally
if (!attrs.getName(i).equals("id")) {
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/PropertyHelper.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/PropertyHelper.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/PropertyHelper.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/PropertyHelper.java Fri Apr 30 20:28:06 2010
@@ -188,14 +188,18 @@ public class PropertyHelper implements G
public String parsePropertyName(
String s, ParsePosition pos, ParseNextProperty notUsed) {
int index = pos.getIndex();
- if (s.indexOf("${", index) == index) {
- int end = s.indexOf('}', index);
+ //directly check near, triggering characters:
+ if (s.length() - index >= 3
+ && '$' == s.charAt(index) && '{' == s.charAt(index + 1)) {
+ int start = index + 2;
+ //defer to String.indexOf() for protracted check:
+ int end = s.indexOf('}', start);
if (end < 0) {
- throw new BuildException("Syntax error in property: " + s);
+ throw new BuildException("Syntax error in property: "
+ + s.substring(index));
}
- int start = index + 2;
pos.setIndex(end + 1);
- return s.substring(start, end);
+ return start == end ? "" : s.substring(start, end);
}
return null;
}
@@ -213,8 +217,16 @@ public class PropertyHelper implements G
public String parsePropertyName(
String s, ParsePosition pos, ParseNextProperty notUsed) {
int index = pos.getIndex();
- if (s.indexOf("$$", index) == index) {
- pos.setIndex(++index);
+ if (s.length() - index >= 2) {
+ /* check for $$; if found, advance by one--
+ * this expander is at the bottom of the stack
+ * and will thus be the last consulted,
+ * so the next thing that ParseProperties will do
+ * is advance the parse position beyond the second $
+ */
+ if ('$' == s.charAt(index) && '$' == s.charAt(++index)) {
+ pos.setIndex(index);
+ }
}
return null;
}
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/RuntimeConfigurable.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/RuntimeConfigurable.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/RuntimeConfigurable.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/RuntimeConfigurable.java Fri Apr 30 20:28:06 2010
@@ -22,10 +22,9 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
-import java.util.HashMap;
import java.util.Hashtable;
+import java.util.LinkedHashMap;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
import java.util.Iterator;
@@ -37,10 +36,12 @@ import org.xml.sax.helpers.AttributeList
* Wrapper class that holds the attributes of an element, its children, and
* any text within it. It then takes care of configuring that element at
* runtime.
- *
*/
public class RuntimeConfigurable implements Serializable {
+ /** Serialization version */
+ private static final long serialVersionUID = 1L;
+
/** Empty Hashtable. */
private static final Hashtable EMPTY_HASHTABLE = new Hashtable(0);
@@ -66,22 +67,15 @@ public class RuntimeConfigurable impleme
/** Attribute names and values. While the XML spec doesn't require
* preserving the order ( AFAIK ), some ant tests do rely on the
- * exact order. The following code is copied from AttributeImpl.
- * We could also just use SAX2 Attributes and convert to SAX1 ( DOM
- * attribute Nodes can also be stored in SAX2 Attributes )
+ * exact order.
* The only exception to this order is the treatment of
* refid. A number of datatypes check if refid is set
* when other attributes are set. This check will not
* work if the build script has the other attribute before
* the "refid" attribute, so now (ANT 1.7) the refid
* attribute will be processed first.
- * (Other than treatment of refid, could just use a LinkedHashMap,
- * but peterreilly's rev 452635 includes no regression test.)
*/
- private List/*<String>*/ attributeNames = null;
-
- /** Map of attribute names to values */
- private Map/*<String,String>*/ attributeMap = null;
+ private LinkedHashMap/*<String, String>*/ attributeMap = null;
/** Text appearing within the element. */
private StringBuffer characters = null;
@@ -188,16 +182,17 @@ public class RuntimeConfigurable impleme
if (name.equalsIgnoreCase(ProjectHelper.ANT_TYPE)) {
this.polyType = value;
} else {
- if (attributeNames == null) {
- attributeNames = new ArrayList();
- attributeMap = new HashMap();
+ if (attributeMap == null) {
+ attributeMap = new LinkedHashMap();
}
- if (name.toLowerCase(Locale.US).equals("refid")) {
- attributeNames.add(0, name);
+ if (name.equalsIgnoreCase("refid") && !attributeMap.isEmpty()) {
+ LinkedHashMap newAttributeMap = new LinkedHashMap();
+ newAttributeMap.put(name, value);
+ newAttributeMap.putAll(attributeMap);
+ attributeMap = newAttributeMap;
} else {
- attributeNames.add(name);
+ attributeMap.put(name, value);
}
- attributeMap.put(name, value);
if (name.equals("id")) {
this.id = value;
}
@@ -209,7 +204,6 @@ public class RuntimeConfigurable impleme
* @param name the name of the attribute to be removed.
*/
public synchronized void removeAttribute(String name) {
- attributeNames.remove(name);
attributeMap.remove(name);
}
@@ -382,10 +376,11 @@ public class RuntimeConfigurable impleme
IntrospectionHelper ih =
IntrospectionHelper.getHelper(p, target.getClass());
- if (attributeNames != null) {
- for (int i = 0; i < attributeNames.size(); i++) {
- String name = (String) attributeNames.get(i);
- String value = (String) attributeMap.get(name);
+ if (attributeMap != null) {
+ for (Iterator iter = attributeMap.entrySet().iterator(); iter.hasNext();) {
+ Map.Entry entry = (Map.Entry) iter.next();
+ String name = (String) entry.getKey();
+ String value = (String) entry.getValue();
// reflect these into the target
Object attrValue = PropertyHelper.getPropertyHelper(p).parseProperties(value);
@@ -395,11 +390,11 @@ public class RuntimeConfigurable impleme
// id attribute must be set externally
if (name.equals("id")) {
// Do nothing
- } else if (getElementTag() == null) {
+ } else if (getElementTag() == null) {
throw be;
} else {
throw new BuildException(
- getElementTag() + " doesn't support the \""
+ getElementTag() + " doesn't support the \""
+ be.getAttribute() + "\" attribute", be);
}
} catch (BuildException be) {
@@ -434,7 +429,6 @@ public class RuntimeConfigurable impleme
maybeConfigure(p);
}
-
/**
* Apply presets, attributes and text are set if not currently set.
* Nested elements are prepended.
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/filters/ClassConstants.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/filters/ClassConstants.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/filters/ClassConstants.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/filters/ClassConstants.java Fri Apr 30 20:28:06 2010
@@ -22,7 +22,7 @@ import java.io.Reader;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.apache.tools.ant.BuildException;
-
+import org.apache.tools.ant.util.ResourceUtils;
/**
* Assembles the constants declared in a Java class in
@@ -104,7 +104,7 @@ public final class ClassConstants
if (clazz == null || clazz.length() == 0) {
ch = -1;
} else {
- final byte[] bytes = clazz.getBytes("ISO-8859-1");
+ final byte[] bytes = clazz.getBytes(ResourceUtils.ISO_8859_1);
try {
final Class javaClassHelper =
Class.forName(JAVA_CLASS_HELPER);
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/filters/SortFilter.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/filters/SortFilter.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/filters/SortFilter.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/filters/SortFilter.java Fri Apr 30 20:28:06 2010
@@ -47,9 +47,9 @@ import org.apache.tools.ant.types.Parame
* </pre>
*
* <p>
- * Sort all files <code>*.txt</code> from <i>src</i> location in descendant
- * order and copy them into <i>build</i> location. The lines of each file are
- * sorted in ascendant order comparing the lines via the
+ * Sort all files <code>*.txt</code> from <i>src</i> location and copy
+ * them into <i>build</i> location. The lines of each file are sorted
+ * in ascendant order comparing the lines via the
* <code>String.compareTo(Object o)</code> method.
* </p>
*
@@ -57,9 +57,7 @@ import org.apache.tools.ant.types.Parame
* <copy todir="build">
* <fileset dir="input" includes="*.txt"/>
* <filterchain>
- * <sortfilter/>
- * <param name="reverse" value="true"/>
- * </sortfilter/>
+ * <sortfilter reverse="true"/>
* </filterchain>
* </copy>
* </pre>
@@ -75,9 +73,9 @@ import org.apache.tools.ant.types.Parame
* <copy todir="build">
* <fileset dir="input" includes="*.txt"/>
* <filterchain>
- * <sortfilter/>
+ * <filterreader classname="org.apache.tools.ant.filters.SortFilter">
* <param name="comparator" value="org.apache.tools.ant.filters.EvenFirstCmp"/>
- * </sortfilter/>
+ * </filterreader>
* </filterchain>
* </copy>
* </pre>
@@ -102,8 +100,23 @@ import org.apache.tools.ant.types.Parame
* }
* </pre>
*
+ * <p>The example above is equivalent to:</p>
+ *
+ * <blockquote><pre>
+ * <componentdef name="evenfirst"
+ * classname="org.apache.tools.ant.filters.EvenFirstCmp"/>
+ * <copy todir="build">
+ * <fileset dir="input" includes="*.txt"/>
+ * <filterchain>
+ * <sortfilter>
+ * <evenfirst/>
+ * </sortfilter>
+ * </filterchain>
+ * </copy>
+ * </pre></blockquote>
+ *
* <p> If parameter <code>comparator</code> is present, then
- * <code>reverse</code> parameter will not taken into account. </p>
+ * <code>reverse</code> parameter will not be taken into account. </p>
*
* @since Ant 1.8.0
*/
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/filters/SuffixLines.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/filters/SuffixLines.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/filters/SuffixLines.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/filters/SuffixLines.java Fri Apr 30 20:28:06 2010
@@ -126,8 +126,8 @@ public final class SuffixLines
* May be <code>null</code>, in which case no suffix
* is added.
*/
- public void setSuffix(final String append) {
- this.suffix = append;
+ public void setSuffix(final String suffix) {
+ this.suffix = suffix;
}
/**
Propchange: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/filters/SuffixLines.java
('svn:mergeinfo' removed)
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/helper/ProjectHelper2.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/helper/ProjectHelper2.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/helper/ProjectHelper2.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/helper/ProjectHelper2.java Fri Apr 30 20:28:06 2010
@@ -177,6 +177,28 @@ public class ProjectHelper2 extends Proj
parse(project, source, new RootHandler(context, mainHandler));
// Execute the top-level target
context.getImplicitTarget().execute();
+
+ // resolve extensionOf attributes
+ for (Iterator i = getExtensionStack().iterator(); i.hasNext(); ) {
+ String[] extensionInfo = (String[]) i.next();
+ String tgName = extensionInfo[0];
+ String name = extensionInfo[1];
+ Hashtable projectTargets = project.getTargets();
+ if (!projectTargets.containsKey(tgName)) {
+ throw new BuildException("can't add target "
+ + name + " to extension-point "
+ + tgName
+ + " because the extension-point"
+ + " is unknown.");
+ }
+ Target t = (Target) projectTargets.get(tgName);
+ if (!(t instanceof ExtensionPoint)) {
+ throw new BuildException("referenced target "
+ + tgName
+ + " is not an extension-point");
+ }
+ t.addDependency(name);
+ }
}
}
@@ -760,17 +782,34 @@ public class ProjectHelper2 extends Proj
String antFileProp =
MagicNames.ANT_FILE + "." + context.getCurrentProjectName();
String dup = project.getProperty(antFileProp);
+ String typeProp =
+ MagicNames.ANT_FILE_TYPE + "." + context.getCurrentProjectName();
+ String dupType = project.getProperty(typeProp);
if (dup != null && nameAttributeSet) {
- File dupFile = new File(dup);
- if (context.isIgnoringProjectTag() && !dupFile.equals(context.getBuildFile())) {
+ Object dupFile = null;
+ Object contextFile = null;
+ if (MagicNames.ANT_FILE_TYPE_URL.equals(dupType)) {
+ try {
+ dupFile = new URL(dup);
+ } catch (java.net.MalformedURLException mue) {
+ throw new BuildException("failed to parse "
+ + dup + " as URL while looking"
+ + " at a duplicate project"
+ + " name.", mue);
+ }
+ contextFile = context.getBuildFileURL();
+ } else {
+ dupFile = new File(dup);
+ contextFile = context.getBuildFile();
+ }
+
+ if (context.isIgnoringProjectTag() && !dupFile.equals(contextFile)) {
project.log("Duplicated project name in import. Project "
+ context.getCurrentProjectName() + " defined first in " + dup
- + " and again in " + context.getBuildFile(), Project.MSG_WARN);
+ + " and again in " + contextFile, Project.MSG_WARN);
}
}
if (nameAttributeSet) {
- String typeProp = MagicNames.ANT_FILE_TYPE + "."
- + context.getCurrentProjectName();
if (context.getBuildFile() != null) {
project.setUserProperty(antFileProp,
context.getBuildFile().toString());
@@ -921,7 +960,7 @@ public class ProjectHelper2 extends Proj
prefix = getTargetPrefix(context);
if (prefix == null) {
throw new BuildException("can't include build file "
- + context.getBuildFile()
+ + context.getBuildFileURL()
+ ", no as attribute has been given"
+ " and the project tag doesn't"
+ " specify a name attribute");
@@ -970,6 +1009,9 @@ public class ProjectHelper2 extends Proj
project.addOrReplaceTarget(newName, newTarget);
}
if (extensionPoint != null) {
+ ProjectHelper helper =
+ (ProjectHelper) context.getProject().
+ getReference(ProjectHelper.PROJECTHELPER_REFERENCE);
for (Iterator iter =
Target.parseDepends(extensionPoint, name, "extensionOf")
.iterator();
@@ -978,20 +1020,12 @@ public class ProjectHelper2 extends Proj
if (isInIncludeMode()) {
tgName = prefix + sep + tgName;
}
- if (!projectTargets.containsKey(tgName)) {
- throw new BuildException("can't add target "
- + name + " to extension-point "
- + tgName
- + " because the extension-point"
- + " is unknown.");
- }
- Target t = (Target) projectTargets.get(tgName);
- if (!(t instanceof ExtensionPoint)) {
- throw new BuildException("referenced target "
- + tgName
- + " is not an extension-point");
- }
- t.addDependency(name);
+
+ // defer extensionpoint resolution until the full
+ // import stack has been processed
+ helper.getExtensionStack().add(new String[] {
+ tgName, name
+ });
}
}
}
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java Fri Apr 30 20:28:06 2010
@@ -859,7 +859,7 @@ public class ProjectHelperImpl extends P
IntrospectionHelper ih = IntrospectionHelper.getHelper(helperImpl.project, parentClass);
try {
- String elementName = propType.toLowerCase(Locale.US);
+ String elementName = propType.toLowerCase(Locale.ENGLISH);
if (parent instanceof UnknownElement) {
UnknownElement uc = new UnknownElement(elementName);
uc.setProject(helperImpl.project);
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/input/InputRequest.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/input/InputRequest.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/input/InputRequest.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/input/InputRequest.java Fri Apr 30 20:28:06 2010
@@ -24,7 +24,7 @@ package org.apache.tools.ant.input;
* @since Ant 1.5
*/
public class InputRequest {
- private String prompt;
+ private final String prompt;
private String input;
private String defaultValue;
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/input/MultipleChoiceInputRequest.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/input/MultipleChoiceInputRequest.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/input/MultipleChoiceInputRequest.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/input/MultipleChoiceInputRequest.java Fri Apr 30 20:28:06 2010
@@ -18,6 +18,7 @@
package org.apache.tools.ant.input;
+import java.util.LinkedHashSet;
import java.util.Vector;
/**
@@ -26,7 +27,7 @@ import java.util.Vector;
* @since Ant 1.5
*/
public class MultipleChoiceInputRequest extends InputRequest {
- private Vector choices = new Vector();
+ private final LinkedHashSet choices;
/**
* @param prompt The prompt to show to the user. Must not be null.
@@ -38,14 +39,14 @@ public class MultipleChoiceInputRequest
if (choices == null) {
throw new IllegalArgumentException("choices must not be null");
}
- this.choices = choices;
+ this.choices = new LinkedHashSet(choices);
}
/**
* @return The possible values.
*/
public Vector getChoices() {
- return choices;
+ return new Vector(choices);
}
/**
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/launch/Locator.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/launch/Locator.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/launch/Locator.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/launch/Locator.java Fri Apr 30 20:28:06 2010
@@ -18,7 +18,6 @@
package org.apache.tools.ant.launch;
import java.net.MalformedURLException;
-
import java.net.URL;
import java.io.File;
import java.io.FilenameFilter;
@@ -442,7 +441,7 @@ public final class Locator {
// Found in java.home as given
return toolsJar;
}
- if (javaHome.toLowerCase(Locale.US).endsWith(File.separator + "jre")) {
+ if (javaHome.toLowerCase(Locale.ENGLISH).endsWith(File.separator + "jre")) {
javaHome = javaHome.substring(
0, javaHome.length() - "/jre".length());
toolsJar = new File(javaHome + libToolsJar);
@@ -498,7 +497,7 @@ public final class Locator {
if (!location.isDirectory()) {
urls = new URL[1];
String path = location.getPath();
- String littlePath = path.toLowerCase(Locale.US);
+ String littlePath = path.toLowerCase(Locale.ENGLISH);
for (int i = 0; i < extensions.length; ++i) {
if (littlePath.endsWith(extensions[i])) {
urls[0] = fileToURL(location);
@@ -510,7 +509,7 @@ public final class Locator {
File[] matches = location.listFiles(
new FilenameFilter() {
public boolean accept(File dir, String name) {
- String littleName = name.toLowerCase(Locale.US);
+ String littleName = name.toLowerCase(Locale.ENGLISH);
for (int i = 0; i < extensions.length; ++i) {
if (littleName.endsWith(extensions[i])) {
return true;
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/listener/BigProjectLogger.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/listener/BigProjectLogger.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/listener/BigProjectLogger.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/listener/BigProjectLogger.java Fri Apr 30 20:28:06 2010
@@ -18,7 +18,6 @@
package org.apache.tools.ant.listener;
import org.apache.tools.ant.BuildEvent;
-import org.apache.tools.ant.NoBannerLogger;
import org.apache.tools.ant.SubBuildListener;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.util.StringUtils;
@@ -33,7 +32,7 @@ import java.io.File;
* @since Ant1.7.1
*/
-public class BigProjectLogger extends NoBannerLogger
+public class BigProjectLogger extends SimpleBigProjectLogger
implements SubBuildListener {
private volatile boolean subBuildStartedRaised = false;
@@ -114,22 +113,6 @@ public class BigProjectLogger extends No
super.messageLogged(event);
}
- /**
- * Override point, extract the target name
- *
- * @param event the event to work on
- * @return the target name -including the owning project name (if non-null)
- */
- protected String extractTargetName(BuildEvent event) {
- String targetName = event.getTarget().getName();
- String projectName = extractProjectName(event);
- if (projectName != null && targetName != null) {
- return projectName + '.' + targetName;
- } else {
- return targetName;
- }
- }
-
/**
* {@inheritDoc}
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/property/ResolvePropertyMap.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/property/ResolvePropertyMap.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/property/ResolvePropertyMap.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/property/ResolvePropertyMap.java Fri Apr 30 20:28:06 2010
@@ -35,6 +35,7 @@ public class ResolvePropertyMap implemen
private final ParseProperties parseProperties;
private final GetProperty master;
private Map map;
+ private String prefix;
/**
* Constructor with a master getproperty and a collection of expanders.
@@ -57,12 +58,19 @@ public class ResolvePropertyMap implemen
throw new BuildException(
"Property " + name + " was circularly " + "defined.");
}
- // Note: the master overrides (even if the name is subsequently
- // prefixed)
- Object masterProperty = master.getProperty(name);
+
+ // if the property has already been set to the name it will
+ // have in the end, then return the existing value to ensure
+ // properties remain immutable
+ String masterPropertyName = name;
+ if (prefix != null) {
+ masterPropertyName = prefix + name;
+ }
+ Object masterProperty = master.getProperty(masterPropertyName);
if (masterProperty != null) {
return masterProperty;
}
+
try {
seen.add(name);
return parseProperties.parseProperties((String) map.get(name));
@@ -74,9 +82,21 @@ public class ResolvePropertyMap implemen
/**
* The action method - resolves all the properties in a map.
* @param map the map to resolve properties in.
+ * @deprecated since Ant 1.8.1, use the two-arg method instead.
*/
public void resolveAllProperties(Map map) {
+ resolveAllProperties(map, null);
+ }
+
+ /**
+ * The action method - resolves all the properties in a map.
+ * @param map the map to resolve properties in.
+ * @param prefix the prefix the properties defined inside the map
+ * will finally receive - may be null.
+ */
+ public void resolveAllProperties(Map map, String prefix) {
this.map = map; // The map gets used in the getProperty callback
+ this.prefix = prefix;
for (Iterator i = map.keySet().iterator(); i.hasNext();) {
String key = (String) i.next();
Object result = getProperty(key);
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Ant.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Ant.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Ant.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Ant.java Fri Apr 30 20:28:06 2010
@@ -41,6 +41,7 @@ import org.apache.tools.ant.MagicNames;
import org.apache.tools.ant.Main;
import org.apache.tools.ant.types.PropertySet;
import org.apache.tools.ant.util.FileUtils;
+import org.apache.tools.ant.util.VectorSet;
/**
* Build a sub-project.
@@ -333,7 +334,7 @@ public class Ant extends Task {
public void execute() throws BuildException {
File savedDir = dir;
String savedAntFile = antFile;
- Vector locals = new Vector(targets);
+ Vector locals = new VectorSet(targets);
try {
getNewProject();
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/AntStructure.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/AntStructure.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/AntStructure.java Fri Apr 30 20:28:06 2010
@@ -27,6 +27,7 @@ import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.Enumeration;
import java.util.Hashtable;
+import java.util.Iterator;
import java.util.Vector;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.IntrospectionHelper;
@@ -95,22 +96,24 @@ public class AntStructure extends Task {
}
printer.printHead(out, getProject(),
- getProject().getTaskDefinitions(),
- getProject().getDataTypeDefinitions());
+ new Hashtable(getProject().getTaskDefinitions()),
+ new Hashtable(getProject().getDataTypeDefinitions()));
printer.printTargetDecl(out);
- Enumeration dataTypes = getProject().getDataTypeDefinitions().keys();
- while (dataTypes.hasMoreElements()) {
- String typeName = (String) dataTypes.nextElement();
+ Iterator dataTypes = getProject().getCopyOfDataTypeDefinitions()
+ .keySet().iterator();
+ while (dataTypes.hasNext()) {
+ String typeName = (String) dataTypes.next();
printer.printElementDecl(
out, getProject(), typeName,
(Class) getProject().getDataTypeDefinitions().get(typeName));
}
- Enumeration tasks = getProject().getTaskDefinitions().keys();
- while (tasks.hasMoreElements()) {
- String tName = (String) tasks.nextElement();
+ Iterator tasks = getProject().getCopyOfTaskDefinitions().keySet()
+ .iterator();
+ while (tasks.hasNext()) {
+ String tName = (String) tasks.next();
printer.printElementDecl(out, getProject(), tName,
(Class) getProject().getTaskDefinitions().get(tName));
}
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=939802&r1=939801&r2=939802&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 Fri Apr 30 20:28:06 2010
@@ -465,7 +465,7 @@ public class Concat extends Task impleme
* Stores a collection of file sets and/or file lists, used to
* select multiple files for concatenation.
*/
- private ResourceCollection rc;
+ private Resources rc;
/** for filtering the concatenated */
private Vector filterChains;
@@ -634,19 +634,15 @@ public class Concat extends Task impleme
* @param c the ResourceCollection to add.
* @since Ant 1.7
*/
- public synchronized void add(ResourceCollection c) {
- if (rc == null) {
- rc = c;
- return;
- }
- if (!(rc instanceof Resources)) {
- Resources newRc = new Resources();
- newRc.setProject(getProject());
- newRc.setCache(true);
- newRc.add(rc);
- rc = newRc;
+ public void add(ResourceCollection c) {
+ synchronized (this) {
+ if (rc == null) {
+ rc = new Resources();
+ rc.setProject(getProject());
+ rc.setCache(true);
+ }
}
- ((Resources) rc).add(c);
+ rc.add(c);
}
/**
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=939802&r1=939801&r2=939802&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 Fri Apr 30 20:28:06 2010
@@ -66,6 +66,9 @@ import org.apache.tools.ant.util.FlatFil
* @ant.task category="filesystem"
*/
public class Copy extends Task {
+ private static final String MSG_WHEN_COPYING_EMPTY_RC_TO_FILE =
+ "Cannot perform operation from directory to file.";
+
static final File NULL_FILE_PLACEHOLDER = new File("/NULL_FILE");
static final String LINE_SEPARATOR = System.getProperty("line.separator");
// CheckStyle:VisibilityModifier OFF - bc
@@ -395,10 +398,22 @@ public class Copy extends Task {
// will be removed in validateAttributes
savedRc = (ResourceCollection) rcs.elementAt(0);
}
- // make sure we don't have an illegal set of options
- validateAttributes();
try {
+ // make sure we don't have an illegal set of options
+ try {
+ validateAttributes();
+ } catch (BuildException e) {
+ if (failonerror
+ || !getMessage(e)
+ .equals(MSG_WHEN_COPYING_EMPTY_RC_TO_FILE)) {
+ throw e;
+ } else {
+ log("Warning: " + getMessage(e), Project.MSG_ERR);
+ return;
+ }
+ }
+
// deal with the single file
copySingleFile();
@@ -631,8 +646,7 @@ public class Copy extends Task {
+ " files.");
}
if (rc.size() == 0) {
- throw new BuildException(
- "Cannot perform operation from directory to file.");
+ throw new BuildException(MSG_WHEN_COPYING_EMPTY_RC_TO_FILE);
} else if (rc.size() == 1) {
Resource res = (Resource) rc.iterator().next();
FileProvider r = (FileProvider) res.as(FileProvider.class);
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Definer.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Definer.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Definer.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Definer.java Fri Apr 30 20:28:06 2010
@@ -271,7 +271,7 @@ public abstract class Definer extends De
URL url = (URL) urls.nextElement();
int fmt = this.format;
- if (url.toString().toLowerCase(Locale.US).endsWith(".xml")) {
+ if (url.toString().toLowerCase(Locale.ENGLISH).endsWith(".xml")) {
fmt = Format.XML;
}
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Ear.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Ear.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Ear.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Ear.java Fri Apr 30 20:28:06 2010
@@ -19,7 +19,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;
@@ -125,9 +124,8 @@ public class Ear extends Jar {
// attribute - or if it's being added twice, meaning the same
// file is specified by the "appxml" attribute and in a
// <fileset> element.
- String vPathLowerCase = vPath.toLowerCase(Locale.ENGLISH);
- if (XML_DESCRIPTOR_PATH.equals(vPathLowerCase)) {
- if (deploymentDescriptor != null
+ if (XML_DESCRIPTOR_PATH.equalsIgnoreCase(vPath)) {
+ if (deploymentDescriptor == null
|| !FILE_UTILS.fileNameEquals(deploymentDescriptor, file)
|| descriptorAdded) {
logWhenWriting("Warning: selected " + archiveType
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Exec.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Exec.java?rev=939802&r1=939801&r2=939802&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Exec.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/Exec.java Fri Apr 30 20:28:06 2010
@@ -25,6 +25,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
+import java.util.Locale;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.MagicNames;
@@ -97,9 +98,9 @@ public class Exec extends Task {
dir = getProject().getBaseDir();
}
- if (myos.toLowerCase().indexOf("windows") >= 0) {
+ if (myos.toLowerCase(Locale.ENGLISH).indexOf("windows") >= 0) {
if (!dir.equals(getProject().resolveFile("."))) {
- if (myos.toLowerCase().indexOf("nt") >= 0) {
+ if (myos.toLowerCase(Locale.ENGLISH).indexOf("nt") >= 0) {
command = "cmd /c cd " + dir + " && " + command;
} else {
String ant = getProject().getProperty(MagicNames.ANT_HOME);
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=939802&r1=939801&r2=939802&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 Fri Apr 30 20:28:06 2010
@@ -401,7 +401,7 @@ public class ExecTask extends Task {
* @param osFamily the family to restrict to.
*/
public void setOsFamily(String osFamily) {
- this.osFamily = osFamily.toLowerCase(Locale.US);
+ this.osFamily = osFamily.toLowerCase(Locale.ENGLISH);
}
/**