You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by jg...@apache.org on 2010/05/03 19:44:28 UTC
svn commit: r940531 [6/7] - in /ant/core/branches/run-single-test-method: ./
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-an...
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/tar/TarEntry.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/tar/TarEntry.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/tar/TarEntry.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/tar/TarEntry.java Mon May 3 17:44:21 2010
@@ -625,7 +625,7 @@ public class TarEntry implements TarCons
*/
private static String normalizeFileName(String fileName,
boolean preserveLeadingSlashes) {
- String osname = System.getProperty("os.name").toLowerCase(Locale.US);
+ String osname = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
if (osname != null) {
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/tar/TarEntry.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 3 17:44:21 2010
@@ -1 +1,2 @@
+/ant/core/tags/ANT_181/src/main/org/apache/tools/tar/TarEntry.java:939905-940517
/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java:755227,755472
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 3 17:44:21 2010
@@ -1 +1,2 @@
+/ant/core/tags/ANT_181/src/main/org/apache/tools/zip:939905-940517
/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip:746933,748133,749524,749855,749859
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/AbstractUnicodeExtraField.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 3 17:44:21 2010
@@ -1,2 +1,3 @@
-/ant/core/trunk/src/main/org/apache/tools/zip/AbstractUnicodeExtraField.java:738844,739300,741089
+/ant/core/tags/ANT_181/src/main/org/apache/tools/zip/AbstractUnicodeExtraField.java:939905-940517
+/ant/core/trunk/src/main/org/apache/tools/zip/AbstractUnicodeExtraField.java:738844,739300,741089,905481-939904
/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/AbstractUnicodeExtraField.java:746933,748063,748133,748288,749342,749524,749855,749859
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ExtraFieldUtils.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ExtraFieldUtils.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ExtraFieldUtils.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ExtraFieldUtils.java Mon May 3 17:44:21 2010
@@ -92,18 +92,19 @@ public class ExtraFieldUtils {
/**
* Split the array into ExtraFields and populate them with the
- * given data as local file data.
+ * given data as local file data, throwing an exception if the
+ * data cannot be parsed.
* @param data an array of bytes as it appears in local file data
* @return an array of ExtraFields
* @throws ZipException on error
*/
public static ZipExtraField[] parse(byte[] data) throws ZipException {
- return parse(data, true);
+ return parse(data, true, UnparseableExtraField.THROW);
}
/**
* Split the array into ExtraFields and populate them with the
- * given data.
+ * given data, throwing an exception if the data cannot be parsed.
* @param data an array of bytes
* @param local whether data originates from the local file data
* or the central directory
@@ -113,14 +114,60 @@ public class ExtraFieldUtils {
*/
public static ZipExtraField[] parse(byte[] data, boolean local)
throws ZipException {
+ return parse(data, local, UnparseableExtraField.THROW);
+ }
+
+ /**
+ * Split the array into ExtraFields and populate them with the
+ * given data.
+ * @param data an array of bytes
+ * @param local whether data originates from the local file data
+ * or the central directory
+ * @param onUnparseableData what to do if the extra field data
+ * cannot be parsed.
+ * @return an array of ExtraFields
+ * @throws ZipException on error
+ * @since Ant 1.8.1
+ */
+ public static ZipExtraField[] parse(byte[] data, boolean local,
+ UnparseableExtraField onUnparseableData)
+ throws ZipException {
List v = new ArrayList();
int start = 0;
+ LOOP:
while (start <= data.length - WORD) {
ZipShort headerId = new ZipShort(data, start);
int length = (new ZipShort(data, start + 2)).getValue();
if (start + WORD + length > data.length) {
- throw new ZipException("data starting at " + start
- + " is in unknown format");
+ switch(onUnparseableData.getKey()) {
+ case UnparseableExtraField.THROW_KEY:
+ throw new ZipException("bad extra field starting at "
+ + start + ". Block length of "
+ + length + " bytes exceeds remaining"
+ + " data of "
+ + (data.length - start - WORD)
+ + " bytes.");
+ case UnparseableExtraField.READ_KEY:
+ UnparseableExtraFieldData field =
+ new UnparseableExtraFieldData();
+ if (local) {
+ field.parseFromLocalFileData(data, start,
+ data.length - start);
+ } else {
+ field.parseFromCentralDirectoryData(data, start,
+ data.length - start);
+ }
+ v.add(field);
+ /*FALLTHROUGH*/
+ case UnparseableExtraField.SKIP_KEY:
+ // since we cannot parse the data we must assume
+ // the extra field consumes the whole rest of the
+ // available data
+ break LOOP;
+ default:
+ throw new ZipException("unknown UnparseableExtraField key: "
+ + onUnparseableData.getKey());
+ }
}
try {
ZipExtraField ze = createExtraField(headerId);
@@ -152,13 +199,19 @@ public class ExtraFieldUtils {
* @since 1.1
*/
public static byte[] mergeLocalFileDataData(ZipExtraField[] data) {
- int sum = WORD * data.length;
+ final boolean lastIsUnparseableHolder = data.length > 0
+ && data[data.length - 1] instanceof UnparseableExtraFieldData;
+ int regularExtraFieldCount =
+ lastIsUnparseableHolder ? data.length - 1 : data.length;
+
+ int sum = WORD * regularExtraFieldCount;
for (int i = 0; i < data.length; i++) {
sum += data[i].getLocalFileDataLength().getValue();
}
+
byte[] result = new byte[sum];
int start = 0;
- for (int i = 0; i < data.length; i++) {
+ for (int i = 0; i < regularExtraFieldCount; i++) {
System.arraycopy(data[i].getHeaderId().getBytes(),
0, result, start, 2);
System.arraycopy(data[i].getLocalFileDataLength().getBytes(),
@@ -167,6 +220,10 @@ public class ExtraFieldUtils {
System.arraycopy(local, 0, result, start + WORD, local.length);
start += (local.length + WORD);
}
+ if (lastIsUnparseableHolder) {
+ byte[] local = data[data.length - 1].getLocalFileDataData();
+ System.arraycopy(local, 0, result, start, local.length);
+ }
return result;
}
@@ -177,13 +234,18 @@ public class ExtraFieldUtils {
* @since 1.1
*/
public static byte[] mergeCentralDirectoryData(ZipExtraField[] data) {
- int sum = WORD * data.length;
+ final boolean lastIsUnparseableHolder = data.length > 0
+ && data[data.length - 1] instanceof UnparseableExtraFieldData;
+ int regularExtraFieldCount =
+ lastIsUnparseableHolder ? data.length - 1 : data.length;
+
+ int sum = WORD * regularExtraFieldCount;
for (int i = 0; i < data.length; i++) {
sum += data[i].getCentralDirectoryLength().getValue();
}
byte[] result = new byte[sum];
int start = 0;
- for (int i = 0; i < data.length; i++) {
+ for (int i = 0; i < regularExtraFieldCount; i++) {
System.arraycopy(data[i].getHeaderId().getBytes(),
0, result, start, 2);
System.arraycopy(data[i].getCentralDirectoryLength().getBytes(),
@@ -192,6 +254,60 @@ public class ExtraFieldUtils {
System.arraycopy(local, 0, result, start + WORD, local.length);
start += (local.length + WORD);
}
+ if (lastIsUnparseableHolder) {
+ byte[] local = data[data.length - 1].getCentralDirectoryData();
+ System.arraycopy(local, 0, result, start, local.length);
+ }
return result;
}
+
+ /**
+ * "enum" for the possible actions to take if the extra field
+ * cannot be parsed.
+ */
+ public static final class UnparseableExtraField {
+ /**
+ * Key for "throw an exception" action.
+ */
+ public static final int THROW_KEY = 0;
+ /**
+ * Key for "skip" action.
+ */
+ public static final int SKIP_KEY = 1;
+ /**
+ * Key for "read" action.
+ */
+ public static final int READ_KEY = 2;
+
+ /**
+ * Throw an exception if field cannot be parsed.
+ */
+ public static final UnparseableExtraField THROW
+ = new UnparseableExtraField(THROW_KEY);
+
+ /**
+ * Skip the extra field entirely and don't make its data
+ * available - effectively removing the extra field data.
+ */
+ public static final UnparseableExtraField SKIP
+ = new UnparseableExtraField(SKIP_KEY);
+
+ /**
+ * Read the extra field data into an instance of {@link
+ * UnparseableExtraFieldData UnparseableExtraFieldData}.
+ */
+ public static final UnparseableExtraField READ
+ = new UnparseableExtraField(READ_KEY);
+
+ private final int key;
+
+ private UnparseableExtraField(int k) {
+ key = k;
+ }
+
+ /**
+ * Key of the action to take.
+ */
+ public int getKey() { return key; }
+ }
}
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ExtraFieldUtils.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 3 17:44:21 2010
@@ -1 +1,3 @@
+/ant/core/tags/ANT_181/src/main/org/apache/tools/zip/ExtraFieldUtils.java:939905-940517
+/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java:910483-910521
/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java:745528,746933,748133,749524,749603,749855,749859
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/FallbackZipEncoding.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 3 17:44:21 2010
@@ -1,2 +1,3 @@
-/ant/core/trunk/src/main/org/apache/tools/zip/FallbackZipEncoding.java:738844,739300,741089
+/ant/core/tags/ANT_181/src/main/org/apache/tools/zip/FallbackZipEncoding.java:939905-940517
+/ant/core/trunk/src/main/org/apache/tools/zip/FallbackZipEncoding.java:738844,739300,741089,905481-939904
/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/FallbackZipEncoding.java:749524,749855,749859
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/NioZipEncoding.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 3 17:44:21 2010
@@ -1,2 +1,3 @@
-/ant/core/trunk/src/main/org/apache/tools/zip/NioZipEncoding.java:738844,739300,741089
+/ant/core/tags/ANT_181/src/main/org/apache/tools/zip/NioZipEncoding.java:939905-940517
+/ant/core/trunk/src/main/org/apache/tools/zip/NioZipEncoding.java:738844,739300,741089,905481-939904
/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java:749524,749855,749859
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/Simple8BitZipEncoding.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 3 17:44:21 2010
@@ -1 +1,2 @@
+/ant/core/tags/ANT_181/src/main/org/apache/tools/zip/Simple8BitZipEncoding.java:939905-940517
/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/Simple8BitZipEncoding.java:749524,749855,749859
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/UnicodeCommentExtraField.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 3 17:44:21 2010
@@ -1,2 +1,3 @@
-/ant/core/trunk/src/main/org/apache/tools/zip/UnicodeCommentExtraField.java:738844,739300,741089
+/ant/core/tags/ANT_181/src/main/org/apache/tools/zip/UnicodeCommentExtraField.java:939905-940517
+/ant/core/trunk/src/main/org/apache/tools/zip/UnicodeCommentExtraField.java:738844,739300,741089,905481-939904
/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/UnicodeCommentExtraField.java:746933,748063,748133,749342,749524,749855,749859
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/UnicodePathExtraField.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 3 17:44:21 2010
@@ -1,2 +1,3 @@
-/ant/core/trunk/src/main/org/apache/tools/zip/UnicodePathExtraField.java:738844,739300,741089
+/ant/core/tags/ANT_181/src/main/org/apache/tools/zip/UnicodePathExtraField.java:939905-940517
+/ant/core/trunk/src/main/org/apache/tools/zip/UnicodePathExtraField.java:738844,739300,741089,905481-939904
/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/UnicodePathExtraField.java:746933,748063,748133,749342,749524,749855,749859
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/UnparseableExtraFieldData.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/UnparseableExtraFieldData.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon May 3 17:44:21 2010
@@ -0,0 +1 @@
+/ant/core/tags/ANT_181/src/main/org/apache/tools/zip/UnparseableExtraFieldData.java:939905-940517
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/UnrecognizedExtraField.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/UnrecognizedExtraField.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/UnrecognizedExtraField.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/UnrecognizedExtraField.java Mon May 3 17:44:21 2010
@@ -66,7 +66,7 @@ public class UnrecognizedExtraField
* @param data the field data to use
*/
public void setLocalFileDataData(byte[] data) {
- localData = copy(data);
+ localData = ZipUtil.copy(data);
}
/**
@@ -82,7 +82,7 @@ public class UnrecognizedExtraField
* @return the local data
*/
public byte[] getLocalFileDataData() {
- return copy(localData);
+ return ZipUtil.copy(localData);
}
/**
@@ -98,7 +98,7 @@ public class UnrecognizedExtraField
* @param data the data to use
*/
public void setCentralDirectoryData(byte[] data) {
- centralData = copy(data);
+ centralData = ZipUtil.copy(data);
}
/**
@@ -119,7 +119,7 @@ public class UnrecognizedExtraField
*/
public byte[] getCentralDirectoryData() {
if (centralData != null) {
- return copy(centralData);
+ return ZipUtil.copy(centralData);
}
return getLocalFileDataData();
}
@@ -140,7 +140,6 @@ public class UnrecognizedExtraField
* @param data the array of bytes.
* @param offset the source location in the data array.
* @param length the number of bytes to use in the data array.
- * @see ZipExtraField#parseFromCentralDirectoryData(byte[], int, int)
*/
public void parseFromCentralDirectoryData(byte[] data, int offset,
int length) {
@@ -152,12 +151,4 @@ public class UnrecognizedExtraField
}
}
- private static byte[] copy(byte[] from) {
- if (from != null) {
- byte[] to = new byte[from.length];
- System.arraycopy(from, 0, to, 0, to.length);
- return to;
- }
- return null;
- }
}
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/UnrecognizedExtraField.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 3 17:44:21 2010
@@ -1 +1,3 @@
+/ant/core/tags/ANT_181/src/main/org/apache/tools/zip/UnrecognizedExtraField.java:939905-940517
+/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/UnrecognizedExtraField.java:910483-910521
/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/UnrecognizedExtraField.java:746933,748133,749603,749855,749859
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipEncoding.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 3 17:44:21 2010
@@ -1,2 +1,3 @@
-/ant/core/trunk/src/main/org/apache/tools/zip/ZipEncoding.java:738844,739300,741089
+/ant/core/tags/ANT_181/src/main/org/apache/tools/zip/ZipEncoding.java:939905-940517
+/ant/core/trunk/src/main/org/apache/tools/zip/ZipEncoding.java:738844,739300,741089,905481-939904
/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncoding.java:749524,749855,749859
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipEncodingHelper.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipEncodingHelper.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipEncodingHelper.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipEncodingHelper.java Mon May 3 17:44:21 2010
@@ -22,6 +22,7 @@ import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.nio.charset.UnsupportedCharsetException;
import java.util.HashMap;
+import java.util.Locale;
import java.util.Map;
/**
@@ -191,6 +192,11 @@ abstract class ZipEncodingHelper {
static final String UTF8 = "UTF8";
/**
+ * variant name of the encoding UTF-8 used for comparisions.
+ */
+ private static final String UTF_DASH_8 = "utf-8";
+
+ /**
* name of the encoding UTF-8
*/
static final ZipEncoding UTF8_ZIP_ENCODING = new FallbackZipEncoding(UTF8);
@@ -240,6 +246,6 @@ abstract class ZipEncodingHelper {
encoding = System.getProperty("file.encoding");
}
return UTF8.equalsIgnoreCase(encoding)
- || "utf-8".equalsIgnoreCase(encoding);
+ || UTF_DASH_8.equalsIgnoreCase(encoding);
}
}
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipEncodingHelper.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 3 17:44:21 2010
@@ -1,2 +1,4 @@
-/ant/core/trunk/src/main/org/apache/tools/zip/ZipEncodingHelper.java:738844,739300,741089
+/ant/core/tags/ANT_181/src/main/org/apache/tools/zip/ZipEncodingHelper.java:939905-940517
+/ant/core/trunk/src/main/org/apache/tools/zip/ZipEncodingHelper.java:738844,739300,741089,905481-939904
+/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java:909456
/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java:746933,747841,748133,749342-749344,749524,749855,749859
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipEntry.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipEntry.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipEntry.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipEntry.java Mon May 3 17:44:21 2010
@@ -18,13 +18,32 @@
package org.apache.tools.zip;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.LinkedHashMap;
+import java.util.List;
import java.util.zip.ZipException;
/**
* Extension that adds better handling of extra fields and provides
* access to the internal and external file attributes.
*
+ * <p>The extra data is expected to follow the recommendation of
+ * {@link http://www.pkware.com/documents/casestudies/APPNOTE.TXT
+ * APPNOTE.txt}:</p>
+ * <ul>
+ * <li>the extra byte array consists of a sequence of extra fields</li>
+ * <li>each extra fields starts by a two byte header id followed by
+ * a two byte sequence holding the length of the remainder of
+ * data.</li>
+ * </ul>
+ *
+ * <p>Any extra data that cannot be parsed by the rules above will be
+ * consumed as "unparseable" extra data and treated differently by the
+ * methods of this class. Versions prior to Apache Commons Compress
+ * 1.1 would have thrown an exception if any attempt was made to read
+ * or write extra data not conforming to the recommendation.</p>
+ *
*/
public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable {
@@ -37,6 +56,7 @@ public class ZipEntry extends java.util.
private int platform = PLATFORM_FAT;
private long externalAttributes = 0;
private LinkedHashMap/*<ZipShort, ZipExtraField>*/ extraFields = null;
+ private UnparseableExtraFieldData unparseableExtra = null;
private String name = null;
/**
@@ -58,7 +78,9 @@ public class ZipEntry extends java.util.
super(entry);
byte[] extra = entry.getExtra();
if (extra != null) {
- setExtraFields(ExtraFieldUtils.parse(extra));
+ setExtraFields(ExtraFieldUtils.parse(extra, true,
+ ExtraFieldUtils
+ .UnparseableExtraField.READ));
} else {
// initializes extra data to an empty byte array
setExtra();
@@ -75,7 +97,7 @@ public class ZipEntry extends java.util.
this((java.util.zip.ZipEntry) entry);
setInternalAttributes(entry.getInternalAttributes());
setExternalAttributes(entry.getExternalAttributes());
- setExtraFields(entry.getExtraFields());
+ setExtraFields(entry.getExtraFields(true));
}
/**
@@ -93,10 +115,9 @@ public class ZipEntry extends java.util.
public Object clone() {
ZipEntry e = (ZipEntry) super.clone();
- e.extraFields = extraFields != null ? (LinkedHashMap) extraFields.clone() : null;
e.setInternalAttributes(getInternalAttributes());
e.setExternalAttributes(getExternalAttributes());
- e.setExtraFields(getExtraFields());
+ e.setExtraFields(getExtraFields(true));
return e;
}
@@ -194,26 +215,46 @@ public class ZipEntry extends java.util.
public void setExtraFields(ZipExtraField[] fields) {
extraFields = new LinkedHashMap();
for (int i = 0; i < fields.length; i++) {
- extraFields.put(fields[i].getHeaderId(), fields[i]);
+ if (fields[i] instanceof UnparseableExtraFieldData) {
+ unparseableExtra = (UnparseableExtraFieldData) fields[i];
+ } else {
+ extraFields.put(fields[i].getHeaderId(), fields[i]);
+ }
}
setExtra();
}
/**
+ * Retrieves all extra fields that have been parsed successfully.
+ * @return an array of the extra fields
+ */
+ public ZipExtraField[] getExtraFields() {
+ return getExtraFields(false);
+ }
+
+ /**
* Retrieves extra fields.
+ * @param includeUnparseable whether to also return unparseable
+ * extra fields as {@link UnparseableExtraFieldData} if such data
+ * exists.
* @return an array of the extra fields
* @since 1.1
*/
- public ZipExtraField[] getExtraFields() {
+ public ZipExtraField[] getExtraFields(boolean includeUnparseable) {
if (extraFields == null) {
- return new ZipExtraField[0];
+ return !includeUnparseable || unparseableExtra == null
+ ? new ZipExtraField[0]
+ : new ZipExtraField[] { unparseableExtra };
+ }
+ List result = new ArrayList(extraFields.values());
+ if (includeUnparseable && unparseableExtra != null) {
+ result.add(unparseableExtra);
}
- ZipExtraField[] result = new ZipExtraField[extraFields.size()];
- return (ZipExtraField[]) extraFields.values().toArray(result);
+ return (ZipExtraField[]) result.toArray(new ZipExtraField[0]);
}
/**
- * Adds an extra fields - replacing an already present extra field
+ * Adds an extra field - replacing an already present extra field
* of the same type.
*
* <p>If no extra field of the same type exists, the field will be
@@ -222,15 +263,19 @@ public class ZipEntry extends java.util.
* @since 1.1
*/
public void addExtraField(ZipExtraField ze) {
- if (extraFields == null) {
- extraFields = new LinkedHashMap();
+ if (ze instanceof UnparseableExtraFieldData) {
+ unparseableExtra = (UnparseableExtraFieldData) ze;
+ } else {
+ if (extraFields == null) {
+ extraFields = new LinkedHashMap();
+ }
+ extraFields.put(ze.getHeaderId(), ze);
}
- extraFields.put(ze.getHeaderId(), ze);
setExtra();
}
/**
- * Adds an extra fields - replacing an already present extra field
+ * Adds an extra field - replacing an already present extra field
* of the same type.
*
* <p>The new extra field will be the first one.</p>
@@ -238,18 +283,22 @@ public class ZipEntry extends java.util.
* @since 1.1
*/
public void addAsFirstExtraField(ZipExtraField ze) {
- LinkedHashMap copy = extraFields;
- extraFields = new LinkedHashMap();
- extraFields.put(ze.getHeaderId(), ze);
- if (copy != null) {
- copy.remove(ze.getHeaderId());
- extraFields.putAll(copy);
+ if (ze instanceof UnparseableExtraFieldData) {
+ unparseableExtra = (UnparseableExtraFieldData) ze;
+ } else {
+ LinkedHashMap copy = extraFields;
+ extraFields = new LinkedHashMap();
+ extraFields.put(ze.getHeaderId(), ze);
+ if (copy != null) {
+ copy.remove(ze.getHeaderId());
+ extraFields.putAll(copy);
+ }
}
setExtra();
}
/**
- * Remove an extra fields.
+ * Remove an extra field.
* @param type the type of extra field to remove
* @since 1.1
*/
@@ -264,6 +313,17 @@ public class ZipEntry extends java.util.
}
/**
+ * Removes unparseable extra field data.
+ */
+ public void removeUnparseableExtraFieldData() {
+ if (unparseableExtra == null) {
+ throw new java.util.NoSuchElementException();
+ }
+ unparseableExtra = null;
+ setExtra();
+ }
+
+ /**
* Looks up an extra field by its header id.
*
* @return null if no such field exists.
@@ -276,7 +336,18 @@ public class ZipEntry extends java.util.
}
/**
- * Throws an Exception if extra data cannot be parsed into extra fields.
+ * Looks up extra field data that couldn't be parsed correctly.
+ *
+ * @return null if no such field exists.
+ */
+ public UnparseableExtraFieldData getUnparseableExtraFieldData() {
+ return unparseableExtra;
+ }
+
+ /**
+ * Parses the given bytes as extra field data and consumes any
+ * unparseable data as an {@link UnparseableExtraFieldData}
+ * instance.
* @param extra an array of bytes to be parsed into extra fields
* @throws RuntimeException if the bytes cannot be parsed
* @since 1.1
@@ -284,10 +355,14 @@ public class ZipEntry extends java.util.
*/
public void setExtra(byte[] extra) throws RuntimeException {
try {
- ZipExtraField[] local = ExtraFieldUtils.parse(extra, true);
+ ZipExtraField[] local =
+ ExtraFieldUtils.parse(extra, true,
+ ExtraFieldUtils.UnparseableExtraField.READ);
mergeExtraFields(local, true);
} catch (Exception e) {
- throw new RuntimeException(e.getMessage(), e);
+ // actually this is not be possible as of Ant 1.8.1
+ throw new RuntimeException("Error parsing extra fields for entry: "
+ + getName() + " - " + e.getMessage(), e);
}
}
@@ -300,7 +375,7 @@ public class ZipEntry extends java.util.
* @since 1.1
*/
protected void setExtra() {
- super.setExtra(ExtraFieldUtils.mergeLocalFileDataData(getExtraFields()));
+ super.setExtra(ExtraFieldUtils.mergeLocalFileDataData(getExtraFields(true)));
}
/**
@@ -308,7 +383,9 @@ public class ZipEntry extends java.util.
*/
public void setCentralDirectoryExtra(byte[] b) {
try {
- ZipExtraField[] central = ExtraFieldUtils.parse(b, false);
+ ZipExtraField[] central =
+ ExtraFieldUtils.parse(b, false,
+ ExtraFieldUtils.UnparseableExtraField.READ);
mergeExtraFields(central, false);
} catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
@@ -331,7 +408,7 @@ public class ZipEntry extends java.util.
* @since 1.1
*/
public byte[] getCentralDirectoryExtra() {
- return ExtraFieldUtils.mergeCentralDirectoryData(getExtraFields());
+ return ExtraFieldUtils.mergeCentralDirectoryData(getExtraFields(true));
}
/**
@@ -413,7 +490,12 @@ public class ZipEntry extends java.util.
setExtraFields(f);
} else {
for (int i = 0; i < f.length; i++) {
- ZipExtraField existing = getExtraField(f[i].getHeaderId());
+ ZipExtraField existing;
+ if (f[i] instanceof UnparseableExtraFieldData) {
+ existing = unparseableExtra;
+ } else {
+ existing = getExtraField(f[i].getHeaderId());
+ }
if (existing == null) {
addExtraField(f[i]);
} else {
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipEntry.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 3 17:44:21 2010
@@ -1,2 +1,4 @@
+/ant/core/tags/ANT_181/src/main/org/apache/tools/zip/ZipEntry.java:939905-940517
+/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java:910483-910521
/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java:747850,749603
/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipEntry.java:746933,748133,749524,749855,749859
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipFile.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipFile.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipFile.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipFile.java Mon May 3 17:44:21 2010
@@ -182,8 +182,8 @@ public class ZipFile {
archive = new RandomAccessFile(f, "r");
boolean success = false;
try {
- Map entriesWithoutEFS = populateFromCentralDirectory();
- resolveLocalFileHeaderData(entriesWithoutEFS);
+ Map entriesWithoutUTF8Flag = populateFromCentralDirectory();
+ resolveLocalFileHeaderData(entriesWithoutUTF8Flag);
success = true;
} finally {
if (!success) {
@@ -308,7 +308,7 @@ public class ZipFile {
*/
private Map populateFromCentralDirectory()
throws IOException {
- HashMap noEFS = new HashMap();
+ HashMap noUTF8Flag = new HashMap();
positionAtCentralDirectory();
@@ -334,10 +334,10 @@ public class ZipFile {
off += SHORT; // skip version info
final int generalPurposeFlag = ZipShort.getValue(cfh, off);
- final boolean hasEFS =
- (generalPurposeFlag & ZipOutputStream.EFS_FLAG) != 0;
+ final boolean hasUTF8Flag =
+ (generalPurposeFlag & ZipOutputStream.UFT8_NAMES_FLAG) != 0;
final ZipEncoding entryEncoding =
- hasEFS ? ZipEncodingHelper.UTF8_ZIP_ENCODING : zipEncoding;
+ hasUTF8Flag ? ZipEncodingHelper.UTF8_ZIP_ENCODING : zipEncoding;
off += SHORT;
@@ -400,11 +400,11 @@ public class ZipFile {
archive.readFully(signatureBytes);
sig = ZipLong.getValue(signatureBytes);
- if (!hasEFS && useUnicodeExtraFields) {
- noEFS.put(ze, new NameAndComment(fileName, comment));
+ if (!hasUTF8Flag && useUnicodeExtraFields) {
+ noUTF8Flag.put(ze, new NameAndComment(fileName, comment));
}
}
- return noEFS;
+ return noUTF8Flag;
}
private static final int MIN_EOCD_SIZE =
@@ -499,7 +499,7 @@ public class ZipFile {
* <p>Also records the offsets for the data to read from the
* entries.</p>
*/
- private void resolveLocalFileHeaderData(Map entriesWithoutEFS)
+ private void resolveLocalFileHeaderData(Map entriesWithoutUTF8Flag)
throws IOException {
Enumeration e = getEntries();
while (e.hasMoreElements()) {
@@ -531,10 +531,10 @@ public class ZipFile {
offsetEntry.dataOffset = offset + LFH_OFFSET_FOR_FILENAME_LENGTH
+ SHORT + SHORT + fileNameLen + extraFieldLen;
- if (entriesWithoutEFS.containsKey(ze)) {
+ if (entriesWithoutUTF8Flag.containsKey(ze)) {
setNameAndCommentFromExtraFields(ze,
(NameAndComment)
- entriesWithoutEFS.get(ze));
+ entriesWithoutUTF8Flag.get(ze));
}
}
}
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipFile.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 3 17:44:21 2010
@@ -1 +1,3 @@
+/ant/core/tags/ANT_181/src/main/org/apache/tools/zip/ZipFile.java:939905-940517
+/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java:911740
/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java:745920,746933,748133,748556,749342-749344,749524,749603,749855,749859
Modified: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipOutputStream.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipOutputStream.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipOutputStream.java (original)
+++ ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipOutputStream.java Mon May 3 17:44:21 2010
@@ -96,11 +96,18 @@ public class ZipOutputStream extends Fil
*/
static final String DEFAULT_ENCODING = null;
- /**
+ /**
+ * General purpose flag, which indicates that filenames are
+ * written in utf-8.
+ */
+ public static final int UFT8_NAMES_FLAG = 1 << 11;
+
+ /**
* General purpose flag, which indicates that filenames are
* written in utf-8.
+ * @deprecated use {@link #UFT8_NAMES_FLAG} instead
*/
- public static final int EFS_FLAG = 1 << 11;
+ public static final int EFS_FLAG = UFT8_NAMES_FLAG;
/**
* Current entry.
@@ -265,9 +272,10 @@ public class ZipOutputStream extends Fil
private RandomAccessFile raf = null;
/**
- * whether to use the EFS flag when writing UTF-8 filenames or not.
+ * whether to use the general purpose bit flag when writing UTF-8
+ * filenames or not.
*/
- private boolean useEFS = true;
+ private boolean useUTF8Flag = true;
/**
* Whether to encode non-encodable file names as UTF-8.
@@ -341,7 +349,7 @@ public class ZipOutputStream extends Fil
public void setEncoding(final String encoding) {
this.encoding = encoding;
this.zipEncoding = ZipEncodingHelper.getZipEncoding(encoding);
- useEFS &= ZipEncodingHelper.isUTF8(encoding);
+ useUTF8Flag &= ZipEncodingHelper.isUTF8(encoding);
}
/**
@@ -362,7 +370,7 @@ public class ZipOutputStream extends Fil
* <p>Defaults to true.</p>
*/
public void setUseLanguageEncodingFlag(boolean b) {
- useEFS = b && ZipEncodingHelper.isUTF8(encoding);
+ useUTF8Flag = b && ZipEncodingHelper.isUTF8(encoding);
}
/**
@@ -1050,7 +1058,7 @@ public class ZipOutputStream extends Fil
// CheckStyle:MagicNumber OFF
int versionNeededToExtract = 10;
- int generalPurposeFlag = (useEFS || utfFallback) ? EFS_FLAG : 0;
+ int generalPurposeFlag = (useUTF8Flag || utfFallback) ? UFT8_NAMES_FLAG : 0;
if (zipMethod == DEFLATED && raf == null) {
// requires version 2 as we are going to store length info
// in the data descriptor
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipOutputStream.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 3 17:44:21 2010
@@ -1 +1,3 @@
+/ant/core/tags/ANT_181/src/main/org/apache/tools/zip/ZipOutputStream.java:939905-940517
+/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java:911740
/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java:745920,747810,747841,748063,749342,749906-749907,750055,750310
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipUtil.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ant/core/branches/run-single-test-method/src/main/org/apache/tools/zip/ZipUtil.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon May 3 17:44:21 2010
@@ -0,0 +1 @@
+/ant/core/tags/ANT_181/src/main/org/apache/tools/zip/ZipUtil.java:939905-940517
Modified: ant/core/branches/run-single-test-method/src/script/ant.bat
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/script/ant.bat?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/script/ant.bat (original)
+++ ant/core/branches/run-single-test-method/src/script/ant.bat Mon May 3 17:44:21 2010
@@ -59,6 +59,7 @@ if "%CLASSPATH%"=="" set _USE_CLASSPATH=
rem Slurp the command line arguments. This loop allows for an unlimited number
rem of arguments (up to the command line limit, anyway).
+set ANT_CMD_LINE_ARGS=
:setupArgs
if ""%1""=="""" goto doneStart
if ""%1""==""-noclasspath"" goto clearclasspath
Modified: ant/core/branches/run-single-test-method/src/script/complete-ant-cmd.pl
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/script/complete-ant-cmd.pl?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/script/complete-ant-cmd.pl (original)
+++ ant/core/branches/run-single-test-method/src/script/complete-ant-cmd.pl Mon May 3 17:44:21 2010
@@ -83,7 +83,7 @@ sub getTargets {
# cache-file.
my $cacheFile = $buildFile;
$cacheFile =~ s|(.*/)?(.*)|${1}.ant-targets-${2}|;
- if ((!-e $cacheFile) || (-M $buildFile) < (-M $cacheFile)) {
+ if ((!-e $cacheFile) || (-z $cacheFile) || (-M $buildFile) < (-M $cacheFile)) {
open( CACHE, '>'.$cacheFile ) || die "can\'t write $cacheFile: $!\n";
open( HELP, "$antCmd -projecthelp -f '$buildFile'|" ) || return();
my %targets;
Modified: ant/core/branches/run-single-test-method/src/tests/antunit/core/classloader-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/tests/antunit/core/classloader-test.xml?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/tests/antunit/core/classloader-test.xml (original)
+++ ant/core/branches/run-single-test-method/src/tests/antunit/core/classloader-test.xml Mon May 3 17:44:21 2010
@@ -23,7 +23,7 @@
<mkdir dir="${input}"/>
<mkdir dir="${output}"/>
<condition property="gump">
- <available classname="org/apache/xerces/jaxp/DocumentBuilderFactoryImpl.class"/>
+ <available classname="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>
</condition>
</target>
@@ -35,7 +35,7 @@
public class A {
public static void main(String[] args) {
if (A.class.getClassLoader().getResource("org/apache/xerces/jaxp/DocumentBuilderFactoryImpl.class") != null) {
- throw new RuntimeException("Didn't expect to find DocumenBuilderImpl");
+ throw new RuntimeException("Didn't expect to find DocumentBuilderImpl");
}
}
}
@@ -54,7 +54,7 @@ public class A {
public static void main(String[] args) {
try {
A.class.getClassLoader().loadClass("org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
- throw new RuntimeException("Didn't expect to find DocumenBuilderImpl");
+ throw new RuntimeException("Didn't expect to find DocumentBuilderImpl");
} catch (ClassNotFoundException cnfe) {
}
}
@@ -74,7 +74,7 @@ public class A {
public class A {
public static void main(String[] args) {
if (A.class.getClassLoader().getResourceAsStream("org/apache/xerces/jaxp/DocumentBuilderFactoryImpl.class") != null) {
- throw new RuntimeException("Didn't expect to find DocumenBuilderImpl");
+ throw new RuntimeException("Didn't expect to find DocumentBuilderImpl");
}
}
}
Modified: ant/core/branches/run-single-test-method/src/tests/antunit/core/extension-point-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/tests/antunit/core/extension-point-test.xml?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/tests/antunit/core/extension-point-test.xml (original)
+++ ant/core/branches/run-single-test-method/src/tests/antunit/core/extension-point-test.xml Mon May 3 17:44:21 2010
@@ -57,30 +57,35 @@
<au:assertLogContains text="In target bar"/>
</target>
- <target name="testExtensionPointMustBeKnown">
+ <target name="testCantAddToPlainTarget">
<mkdir dir="${output}"/>
<echo file="${output}/build.xml"><![CDATA[
<project default="foo">
- <extension-point name="bar" extensionOf="foo"/>
- <extension-point name="foo"/>
+ <target name="foo"/>
+ <target name="bar" extensionOf="foo"/>
</project>]]></echo>
<au:expectfailure
- expectedMessage="can't add target bar to extension-point foo because the extension-point is unknown">
+ expectedMessage="referenced target foo is not an extension-point">
<ant dir="${output}"/>
</au:expectfailure>
</target>
- <target name="testCantAddToPlainTarget">
+ <target name="testExtensionPointInImportedBuildfile" description="Bug 48804">
<mkdir dir="${output}"/>
+ <echo file="${output}/master.xml"><![CDATA[
+<project default="bar">
+ <extension-point name="foo"/>
+ <target name="bar" depends="foo"/>
+</project>]]></echo>
<echo file="${output}/build.xml"><![CDATA[
-<project default="foo">
- <target name="foo"/>
- <target name="bar" extensionOf="foo"/>
+<project>
+ <import file="master.xml"/>
+ <target name="prepare" extensionOf="foo">
+ <echo>in target prepare</echo>
+ </target>
</project>]]></echo>
- <au:expectfailure
- expectedMessage="referenced target foo is not an extension-point">
- <ant dir="${output}"/>
- </au:expectfailure>
+ <ant dir="${output}" target="bar"/>
+ <au:assertLogContains text="in target prepare"/>
</target>
</project>
Propchange: ant/core/branches/run-single-test-method/src/tests/antunit/core/extension-point-test.xml
('svn:mergeinfo' removed)
Propchange: ant/core/branches/run-single-test-method/src/tests/antunit/core/ref-psyntax-hint-test.xml
('svn:mergeinfo' removed)
Propchange: ant/core/branches/run-single-test-method/src/tests/antunit/filters/suffix-test.xml
('svn:mergeinfo' removed)
Modified: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/concat-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/concat-test.xml?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/concat-test.xml (original)
+++ ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/concat-test.xml Mon May 3 17:44:21 2010
@@ -18,7 +18,7 @@
<project default="antunit" xmlns:au="antlib:org.apache.ant.antunit">
<import file="../antunit-base.xml" />
- <target name="tearDown">
+ <target name="tearDown" depends="antunit-base.tearDown">
<delete file="concat.resources" />
</target>
@@ -149,4 +149,14 @@
</fail>
</target>
+ <target name="testBug48816">
+ <concat>
+ <resources id="48816" />
+ <string value="x" />
+ </concat>
+ <au:assertTrue>
+ <resourcecount refid="48816" count="0" />
+ </au:assertTrue>
+ </target>
+
</project>
Modified: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/copy-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/copy-test.xml?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/copy-test.xml (original)
+++ ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/copy-test.xml Mon May 3 17:44:21 2010
@@ -116,6 +116,48 @@ public class NullByteStreamResource exte
actual="${output}/bar.txt"/>
</target>
+ <target name="testMappedResourcesMultipleTrue">
+ <mkdir dir="${input}"/>
+ <mkdir dir="${output}"/>
+ <echo file="${input}/foo.txt">Hello, world!</echo>
+ <copy todir="${output}">
+ <mappedresources enableMultipleMappings="true">
+ <fileset dir="${input}"/>
+ <compositemapper>
+ <globmapper from="foo.*" to="bar.*"/>
+ <globmapper from="foo.*" to="baz.*"/>
+ </compositemapper>
+ </mappedresources>
+ </copy>
+ <au:assertFileDoesntExist file="${output}/foo.txt"/>
+ <au:assertFileExists file="${output}/bar.txt"/>
+ <au:assertFileExists file="${output}/baz.txt"/>
+ <au:assertFilesMatch expected="${input}/foo.txt"
+ actual="${output}/bar.txt"/>
+ <au:assertFilesMatch expected="${input}/foo.txt"
+ actual="${output}/baz.txt"/>
+ </target>
+
+ <target name="testMappedResourcesMultipleFalse">
+ <mkdir dir="${input}"/>
+ <mkdir dir="${output}"/>
+ <echo file="${input}/foo.txt">Hello, world!</echo>
+ <copy todir="${output}">
+ <mappedresources enableMultipleMappings="false">
+ <fileset dir="${input}"/>
+ <compositemapper>
+ <globmapper from="foo.*" to="bar.*"/>
+ <globmapper from="foo.*" to="baz.*"/>
+ </compositemapper>
+ </mappedresources>
+ </copy>
+ <au:assertFileDoesntExist file="${output}/foo.txt"/>
+ <au:assertFileExists file="${output}/bar.txt"/>
+ <au:assertFileDoesntExist file="${output}/baz.txt"/>
+ <au:assertFilesMatch expected="${input}/foo.txt"
+ actual="${output}/bar.txt"/>
+ </target>
+
<target name="testIncludeEmptyDirsDefaultsToTrue"
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=47168">
<mkdir dir="${input}/foo"/>
@@ -188,4 +230,69 @@ public class NullByteStreamResource exte
</copy>
<au:assertFileExists file="${output}/foo.jpg"/>
</target>
+
+ <target name="testMissingFileUsingFileAttribute">
+ <mkdir dir="${output}"/>
+ <mkdir dir="${input}"/>
+ <au:expectfailure expectedMessage="Could not find file">
+ <copy file="${input}/not-there.txt" todir="${output}"/>
+ </au:expectfailure>
+ <copy file="${input}/not-there.txt" todir="${output}"
+ failonerror="false"/>
+ </target>
+
+ <target name="testMissingFilesetRoot">
+ <mkdir dir="${output}"/>
+ <au:expectfailure expectedMessage="does not exist">
+ <copy todir="${output}">
+ <fileset dir="${input}">
+ <include name="not-there.txt"/>
+ </fileset>
+ </copy>
+ </au:expectfailure>
+ <copy todir="${output}" failonerror="false">
+ <fileset dir="${input}">
+ <include name="not-there.txt"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="testMissingFileUsingFilesetInclude"
+ description="https://issues.apache.org/bugzilla/show_bug.cgi?id=49070">
+ <mkdir dir="${output}"/>
+ <mkdir dir="${input}"/>
+ <au:expectfailure
+ expectedMessage="Cannot perform operation from directory to file.">
+ <copy tofile="${output}/foo.txt">
+ <fileset dir="${input}">
+ <include name="not-there.txt"/>
+ </fileset>
+ </copy>
+ </au:expectfailure>
+ <copy tofile="${output}/foo.txt" failonerror="false">
+ <fileset dir="${input}">
+ <include name="not-there.txt"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="testMissingFileUsingFilesetFilename"
+ description="https://issues.apache.org/bugzilla/show_bug.cgi?id=49070">
+ <mkdir dir="${output}"/>
+ <mkdir dir="${input}"/>
+ <au:expectfailure
+ expectedMessage="Cannot perform operation from directory to file.">
+ <copy tofile="${output}/foo.txt">
+ <fileset dir="${input}">
+ <filename name="not-there.txt"/>
+ </fileset>
+ </copy>
+ </au:expectfailure>
+ <copy tofile="${output}/foo.txt" failonerror="false">
+ <fileset dir="${input}">
+ <filename name="not-there.txt"/>
+ </fileset>
+ </copy>
+ </target>
+
</project>
Propchange: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/dependset-test.xml
('svn:mergeinfo' removed)
Propchange: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/exec/exec-test.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/exec/exec-test.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/exec/exec-test.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon May 3 17:44:21 2010
@@ -0,0 +1 @@
+/ant/core/tags/ANT_181/src/tests/antunit/taskdefs/exec/exec-test.xml:939905-940517
Propchange: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/exec/expected/utf-8
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/exec/expected/utf-8
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/exec/expected/utf-8
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon May 3 17:44:21 2010
@@ -0,0 +1 @@
+/ant/core/tags/ANT_181/src/tests/antunit/taskdefs/exec/expected/utf-8:939905-940517
Propchange: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/exec/input/iso8859-1
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/exec/input/iso8859-1
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/exec/input/iso8859-1
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon May 3 17:44:21 2010
@@ -0,0 +1 @@
+/ant/core/tags/ANT_181/src/tests/antunit/taskdefs/exec/input/iso8859-1:939905-940517
Modified: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/get-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/get-test.xml?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/get-test.xml (original)
+++ ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/get-test.xml Mon May 3 17:44:21 2010
@@ -96,4 +96,17 @@
<au:assertFileExists file="${output}/downloads/index.html"/>
<au:assertFileExists file="${output}/downloads/faq.html"/>
</target>
+
+ <target name="XtestRelativeRedirect">
+ <get src="${location}/local.cgi" dest="${output}/other.tmp"/>
+ <au:assertTrue>
+ <resourcecount count="1">
+ <restrict>
+ <file file="${output}/other.tmp" />
+ <contains text="local redirect succeeded"/>
+ </restrict>
+ </resourcecount>
+ </au:assertTrue>
+ <au:assertLogContains text="local.cgi moved to http" />
+ </target>
</project>
Modified: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/hostinfo-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/hostinfo-test.xml?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/hostinfo-test.xml (original)
+++ ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/hostinfo-test.xml Mon May 3 17:44:21 2010
@@ -29,8 +29,8 @@
<property name="apache-hostname" value="www.apache.org" />
<property name="apache-domain" value="apache.org" />
- <property name="apache-realhost" value="aurora" />
- <property name="apache-ip4" value="192.87.106.226" />
+ <property name="apache-realhost" value="eos" />
+ <property name="apache-ip4" value="140.211.11.130" />
<property name="xs4all-hostname" value="www.xs4all.nl" />
<property name="xs4all-domain" value="xs4all.nl" />
Modified: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/import-url-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/import-url-test.xml?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/import-url-test.xml (original)
+++ ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/import-url-test.xml Mon May 3 17:44:21 2010
@@ -40,15 +40,20 @@
<echo file="${input}/a/c/test.properties"><![CDATA[
foo=bar
]]></echo>
- <mkdir dir="${output}"/>
- <jar destfile="${output}/test.jar">
+ <property name="test.jar" location="${java.io.tmpdir}/test.jar"/>
+ <jar destfile="${test.jar}">
<fileset dir="${input}"/>
</jar>
<delete dir="${input}"/>
<import>
<javaresource name="a/b/outer.xml">
- <classpath location="${output}/test.jar"/>
+ <classpath location="${test.jar}"/>
+ </javaresource>
+ </import>
+ <import>
+ <javaresource name="a/b/outer.xml">
+ <classpath location="${test.jar}"/>
</javaresource>
</import>
@@ -58,15 +63,14 @@ foo=bar
<au:assertLogContains text="foo is bar"/>
</target>
- <target name="tearDown" depends="close, antunit-base.tearDown"/>
-
- <target name="close">
+ <target name="tearDown" depends="antunit-base.tearDown">
<taskdef name="close"
classname="org.apache.tools.ant.taskdefs.CloseResources"/>
<close>
<javaresource name="a/b/outer.xml">
- <classpath location="${output}/test.jar"/>
+ <classpath location="${test.jar}"/>
</javaresource>
</close>
+ <delete file="${test.jar}" quiet="true" deleteonexit="true"/>
</target>
</project>
Propchange: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/include-test.xml
('svn:mergeinfo' removed)
Modified: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/jar-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/jar-test.xml?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/jar-test.xml (original)
+++ ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/jar-test.xml Mon May 3 17:44:21 2010
@@ -179,4 +179,32 @@
<au:assertResourceContains value="Second-Origin: test.jar"
resource="${output}/META-INF/MANIFEST.MF"/>
</target>
+
+ <target name="testDuplicateFail">
+ <mkdir dir="${input}/1"/>
+ <mkdir dir="${input}/2"/>
+ <mkdir dir="${output}"/>
+ <touch file="${input}/1/a.txt"/>
+ <touch file="${input}/2/a.txt"/>
+ <au:expectfailure message="Duplicate file">
+ <jar destfile="${output}/test.jar" duplicate="fail">
+ <fileset dir="${input}/1"/>
+ <fileset dir="${input}/2"/>
+ </jar>
+ </au:expectfailure>
+ </target>
+
+ <target name="testFileSetMerge"
+ description="https://issues.apache.org/bugzilla/show_bug.cgi?id=49090">
+ <mkdir dir="${input}/META-INF"/>
+ <mkdir dir="${output}"/>
+ <echo file="${input}/META-INF/MANIFEST.MF"><![CDATA[Test: Header
+]]></echo>
+ <jar destfile="${output}/test.jar" filesetmanifest="merge">
+ <fileset dir="${input}"/>
+ </jar>
+ <unjar src="${output}/test.jar" dest="${output}"/>
+ <au:assertResourceContains value="Test: Header"
+ resource="${output}/META-INF/MANIFEST.MF"/>
+ </target>
</project>
Modified: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/length-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/length-test.xml?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/length-test.xml (original)
+++ ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/length-test.xml Mon May 3 17:44:21 2010
@@ -230,4 +230,11 @@
</au:assertTrue>
</target>
+ <target name="testResourceAttribute">
+ <string id="s" value="foo-bar-baz" />
+ <au:assertTrue>
+ <length length="11" resource="${ant.refid:s}" />
+ </au:assertTrue>
+ </target>
+
</project>
Modified: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/loadproperties-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/loadproperties-test.xml?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/loadproperties-test.xml (original)
+++ ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/loadproperties-test.xml Mon May 3 17:44:21 2010
@@ -15,10 +15,15 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<project default="antunit" xmlns:au="antlib:org.apache.ant.antunit">
+<project name="loadproperties-test" default="antunit" xmlns:au="antlib:org.apache.ant.antunit">
<import file="../antunit-base.xml" />
+ <target name="setUp">
+ <mkdir dir="${input}" />
+ <property name="properties.tmp" location="${input}/properties.tmp" />
+ </target>
+
<target name="test-basic">
<loadproperties>
<string>basic.foo=foo
@@ -68,4 +73,120 @@ a=Hello world in EBCDIC
<au:assertPropertyEquals name="a" value="Hello world in EBCDIC"/>
</target>
+ <target name="testPrefixedProperties" depends="setUp">
+ <property name="server" value="localhost"/>
+ <echo file="${properties.tmp}">
+#http.@PORT@ = 90
+http.@PORT@ = 80
+http.@SERVER@ = ${server}
+ </echo>
+ <loadproperties srcFile="${properties.tmp}">
+ <filterchain>
+ <striplinecomments>
+ <comment value="#"/>
+ </striplinecomments>
+ <prefixlines prefix="server1."/>
+ <replacetokens>
+ <token key="PORT" value="port"/>
+ <token key="SERVER" value="server"/>
+ </replacetokens>
+ <expandproperties/>
+ </filterchain>
+ </loadproperties>
+ <property name="server1.http.url"
+ value="http://${server1.http.server}:${server1.http.port}"/>
+ </target>
+
+ <target name="testLineCommentsWithoutFiltering">
+ <loadproperties>
+ <string value="#foo=bar" />
+ </loadproperties>
+ <au:assertFalse>
+ <isset property="foo" />
+ </au:assertFalse>
+ </target>
+
+ <target name="testPrefixAttributeProperties">
+ <loadproperties prefix="prefixFromAttribute.">
+ <string>foo=foo
+bar=bar
+baz=${foo} ${bar}
+ </string>
+ </loadproperties>
+ <au:assertTrue>
+ <and>
+ <equals arg1="foo" arg2="${prefixFromAttribute.foo}" />
+ <equals arg1="bar" arg2="${prefixFromAttribute.bar}" />
+ <equals arg1="foo bar" arg2="${prefixFromAttribute.baz}" />
+ </and>
+ </au:assertTrue>
+ </target>
+
+ <target name="testSelfContainedPrefixFilterFailure"
+ description="Show why the prefix attribute is needed">
+ <loadproperties>
+ <string>foo=foo
+bar=bar
+baz=${foo} ${bar}
+ </string>
+ <filterchain>
+ <prefixlines prefix="prefixFromFilter." />
+ </filterchain>
+ </loadproperties>
+ <au:assertTrue>
+ <and>
+ <equals arg1="$${foo} $${bar}" arg2="${prefixFromFilter.baz}" />
+ <isset property="prefixFromFilter." />
+ </and>
+ </au:assertTrue>
+ </target>
+
+ <target name="write properties.tmp" depends="setUp">
+ <echo file="${properties.tmp}">
+#tpfr.a=a
+tpfr.a=A
+tpfr.b=b\
+ e
+tpfr.c=@C@
+ </echo>
+ </target>
+
+ <presetdef name="assertPropertiesFromResourceOkay">
+ <au:assertTrue>
+ <equals arg1="Abesea" arg2="${tpfr.a}${tpfr.b}${tpfr.c}" />
+ </au:assertTrue>
+ </presetdef>
+
+ <target name="testPropertiesFromResource" depends="write properties.tmp">
+ <loadproperties resource="properties.tmp" classpath="${input}">
+ <filterchain>
+ <replacetokens>
+ <token key="C" value="sea"/>
+ </replacetokens>
+ </filterchain>
+ </loadproperties>
+ </target>
+
+ <target name="testPropertiesFromFileSet" depends="write properties.tmp">
+ <loadproperties>
+ <fileset file="${properties.tmp}" />
+ <filterchain>
+ <replacetokens>
+ <token key="C" value="sea"/>
+ </replacetokens>
+ </filterchain>
+ </loadproperties>
+ <assertPropertiesFromResourceOkay />
+ </target>
+
+ <target name="testLastPropertyWins">
+ <loadproperties>
+ <string>foo=foo
+foo=bar</string>
+ </loadproperties>
+ <au:assertTrue>
+ <equals arg1="bar" arg2="${foo}" />
+ </au:assertTrue>
+ </target>
+
</project>
Modified: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/optional/junit/junit-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/optional/junit/junit-test.xml?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/optional/junit/junit-test.xml (original)
+++ ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/optional/junit/junit-test.xml Mon May 3 17:44:21 2010
@@ -289,4 +289,13 @@ public class BTest extends TestCase {
<au:assertLogDoesntContain text="Running test.HTest"/>
</target>
+ <target name="testMissingTestName">
+ <property name="test.name" value="null"/>
+ <au:expectfailure message="test name must be specified">
+ <junit fork="false">
+ <test name="${test.name}"/>
+ </junit>
+ </au:expectfailure>
+ </target>
+
</project>
Propchange: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/optional/native2ascii-test.xml
('svn:mergeinfo' removed)
Modified: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/optional/propertyfilelayout-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/optional/propertyfilelayout-test.xml?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/optional/propertyfilelayout-test.xml (original)
+++ ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/optional/propertyfilelayout-test.xml Mon May 3 17:44:21 2010
@@ -26,6 +26,7 @@ foo=bar
#second comment
x=1
]]></echo>
+ <fixcrlf file="${input}/initial.properties"/>
<presetdef name="pf">
<propertyfile file="${output}/created.properties">
<entry key="foo" value="bar"/>
Modified: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/optional/unix/symlink-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/optional/unix/symlink-test.xml?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/optional/unix/symlink-test.xml (original)
+++ ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/optional/unix/symlink-test.xml Mon May 3 17:44:21 2010
@@ -92,4 +92,18 @@
<au:assertFileDoesntExist file="${output}/link"/>
</target>
+ <target name="testDeleteLinkInSameDirAsBuildFile" depends="setUp" if="isUnix"
+ description="https://issues.apache.org/bugzilla/show_bug.cgi?id=49137">
+ <mkdir dir="${output}/Templates"/>
+ <mkdir dir="${output}/project1"/>
+ <symlink action="single" link="${output}/project1/Templates"
+ resource="../Templates"/>
+ <echo file="${output}/project1/build.xml"><![CDATA[
+<project name="project1" default="build" basedir=".">
+ <target name="build">
+ <symlink action="delete" link="Templates"/>
+ </target>
+</project>]]></echo>
+ <ant antfile="${output}/project1/build.xml"/>
+ </target>
</project>
Modified: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/property-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/property-test.xml?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/property-test.xml (original)
+++ ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/property-test.xml Mon May 3 17:44:21 2010
@@ -77,4 +77,15 @@
<property name="foo" location="${testfile}" relative="true" basedir=".."/>
<au:assertPropertyEquals name="foo" value="taskdefs${file.separator}${testfile}"/>
</target>
+
+ <target name="testNestedExpansionHonorsImmutability">
+ <mkdir dir="${input}"/>
+ <property name="x" value="x"/>
+ <echo file="${input}/x.properties"><![CDATA[
+x=y
+y=$${x}
+]]></echo>
+ <property file="${input}/x.properties"/>
+ <au:assertPropertyEquals name="y" value="x"/>
+ </target>
</project>
Modified: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/rmic-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/rmic-test.xml?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/rmic-test.xml (original)
+++ ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/rmic-test.xml Mon May 3 17:44:21 2010
@@ -76,4 +76,31 @@ public class Adapter implements RmicAdap
</rmic>
<au:assertLogContains text="adapter called"/>
</target>
+
+ <target name="testSourceBase"
+ description="https://issues.apache.org/bugzilla/show_bug.cgi?id=48970">
+ <mkdir dir="${input}/org/example"/>
+ <mkdir dir="${output}"/>
+ <echo file="${input}/org/example/Foo.java"><![CDATA[
+package org.example;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+public interface Foo extends Remote {
+ long bar() throws RemoteException ;
+}]]></echo>
+ <echo file="${input}/org/example/FooImpl.java"><![CDATA[
+package org.example;
+import java.rmi.RemoteException;
+public class FooImpl implements Foo {
+ public long bar() throws RemoteException {
+ return 0;
+ }
+}]]></echo>
+ <javac srcdir="${input}" destdir="${output}"/>
+ <rmic sourcebase="${input}" base="${output}">
+ <include name="**/*Impl.class"/>
+ </rmic>
+ <au:assertFileExists file="${input}/org/example/FooImpl_Stub.java"/>
+ <au:assertFileDoesntExist file="${output}/org/example/FooImpl_Stub.java"/>
+ </target>
</project>
Modified: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/unzip-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/unzip-test.xml?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/unzip-test.xml (original)
+++ ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/unzip-test.xml Mon May 3 17:44:21 2010
@@ -59,7 +59,7 @@
>
<mkdir dir="${input}"/>
<mkdir dir="${output}"/>
- <copy file="zip/Bugzilla-46559.zip" tofile="${input}/test.zip"/>
+ <copy file="broken_cd.zip" tofile="${input}/test.zip"/>
<au:expectfailure>
<unzip src="${input}/test.zip" dest="${output}"/>
</au:expectfailure>
Modified: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/war-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/war-test.xml?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/war-test.xml (original)
+++ ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/war-test.xml Mon May 3 17:44:21 2010
@@ -16,34 +16,28 @@
limitations under the License.
-->
-<project name="war-test" basedir="." default="antunit"
+<project name="war-test" default="antunit"
xmlns:au="antlib:org.apache.ant.antunit">
- <property name="working.dir" value="working"/>
<import file="../antunit-base.xml" />
- <target name="init">
- <delete dir="${working.dir}"/>
- <mkdir dir="${working.dir}"/>
- <property name="warfile" location="${working.dir}/test.war"/>
+ <target name="setUp">
+ <mkdir dir="${input}"/>
+ <property name="warfile" location="${input}/test.war"/>
<property name="web.xml" location="web.xml"/>
- <property name="webxml.generated" location="${working.dir}/WEB-INF/web.xml"/>
+ <property name="webxml.generated" location="${input}/WEB-INF/web.xml"/>
<!--failing on duplicates is half our testing-->
<presetdef name="mkwar">
<war destfile="${warfile}" duplicate="fail"/>
</presetdef>
<presetdef name="expandwar">
- <unzip src="${working.dir}/test.war" dest="${working.dir}"/>
+ <unzip src="${input}/test.war" dest="${input}"/>
</presetdef>
</target>
- <target name="tearDown">
- <delete dir="${working.dir}"/>
- </target>
-
<!--test that you can patch a fileset reference into a lib element-->
- <target name="testlibrefs" depends="init">
+ <target name="testlibrefs" depends="setUp">
<mkwar webxml="${web.xml}">
<fileset id="test" dir="." includes="web.xml"/>
<lib refid="test"/>
@@ -56,7 +50,7 @@
This checks that as of Java EE 5, the web.xml attr is optional.
Here there is a web.xml, in the webinf fileset, rather than a fileset
-->
- <target name="testWebXmlInWebinf" depends="init">
+ <target name="testWebXmlInWebinf" depends="setUp">
<mkwar>
<webinf dir="." includes="web.xml"/>
</mkwar>
@@ -64,7 +58,7 @@
<au:assertFileExists file="${webxml.generated}" />
</target>
- <target name="testWebXmlMissingFromUpdate" depends="init">
+ <target name="testWebXmlMissingFromUpdate" depends="setUp">
<mkwar webxml="${web.xml}" />
<!-- there is no web.xml file, but that is ok, as
we are updating -->
@@ -75,7 +69,7 @@
<au:assertFileExists file="${webxml.generated}" />
</target>
- <target name="testWebXmlInImplicitUpdate" depends="init">
+ <target name="testWebXmlInImplicitUpdate" depends="setUp">
<mkwar webxml="${web.xml}" />
<!-- when we are implicitly updating, the web.xml file does not get
pulled in, but the command still succeeds.-->
@@ -86,7 +80,7 @@
<au:assertFileExists file="${webxml.generated}" />
</target>
- <target name="NotestWebXmlFilesetInImplicitUpdate" depends="init">
+ <target name="NotestWebXmlFilesetInImplicitUpdate" depends="setUp">
<mkwar webxml="${web.xml}" />
<!-- when we are implicitly updating, the web.xml file does not get
pulled in, but the command still succeeds.-->
@@ -98,7 +92,7 @@
</target>
- <target name="testDuplicateWebXml" depends="init">
+ <target name="testDuplicateWebXml" depends="setUp">
<mkwar webxml="${web.xml}" >
<webinf dir="." includes="web.xml"/>
<webinf file="${web.xml}"/>
@@ -108,10 +102,10 @@
<au:assertFileExists file="${webxml.generated}" />
</target>
- <target name="testDifferentDuplicateWebXml" depends="init">
- <copy file="${web.xml}" todir="${working.dir}" />
+ <target name="testDifferentDuplicateWebXml" depends="setUp">
+ <copy file="${web.xml}" todir="${input}" />
<mkwar webxml="${web.xml}" >
- <webinf dir="${working.dir}" includes="web.xml"/>
+ <webinf dir="${input}" includes="web.xml"/>
<webinf file="${web.xml}"/>
<zipfileset file="${web.xml}" prefix="WEB-INF"/>
</mkwar>
@@ -125,18 +119,18 @@
this target does not have a web.xml file.
Instead it pulls in
-->
- <target name="testWebXmlOptional" depends="init">
+ <target name="testWebXmlOptional" depends="setUp">
<mkwar needxmlfile="false">
<classes dir="." includes="web.xml"/>
</mkwar>
<expandwar/>
- <au:assertFileExists file="${working.dir}/WEB-INF/classes/web.xml" />
+ <au:assertFileExists file="${input}/WEB-INF/classes/web.xml" />
<au:assertFalse>
<available file="${webxml.generated}" />
</au:assertFalse>
</target>
- <target name="testWebXmlOptionalFailure" depends="init">
+ <target name="testWebXmlOptionalFailure" depends="setUp">
<au:expectfailure>
<mkwar >
<classes dir="." includes="web.xml"/>
@@ -144,7 +138,7 @@
</au:expectfailure>
</target>
- <target name="testWebXmlOptionalFailure2" depends="init">
+ <target name="testWebXmlOptionalFailure2" depends="setUp">
<au:expectfailure>
<mkwar needxmlfile="true">
<classes dir="." includes="web.xml"/>
@@ -152,20 +146,20 @@
</au:expectfailure>
</target>
- <target name="testClassesElement" depends="init">
+ <target name="testClassesElement" depends="setUp">
<mkwar needxmlfile="false">
<classes dir="." includes="web.xml"/>
</mkwar>
<expandwar/>
- <au:assertFileExists file="${working.dir}/WEB-INF/classes/web.xml" />
+ <au:assertFileExists file="${input}/WEB-INF/classes/web.xml" />
</target>
- <target name="testLibElement" depends="init">
+ <target name="testLibElement" depends="setUp">
<mkwar needxmlfile="false">
<lib dir="." includes="web.xml"/>
</mkwar>
<expandwar/>
- <au:assertFileExists file="${working.dir}/WEB-INF/lib/web.xml" />
+ <au:assertFileExists file="${input}/WEB-INF/lib/web.xml" />
</target>
<target name="testMappedClasspathFromManual">
@@ -186,4 +180,15 @@
<unzip src="${output}/test.war" dest="${output}/out"/>
<au:assertFileExists file="${output}/out/WEB-INF/lib/ant.jar"/>
</target>
+
+ <target name="testOnlyOneWebXml">
+ <mkdir dir="${input}/WEB-INF"/>
+ <mkdir dir="${output}"/>
+ <touch file="${input}/WEB-INF/web.xml"/>
+ <touch file="${input}/x.xml"/>
+ <war destfile="${output}/test.war" webxml="${input}/x.xml">
+ <fileset dir="${input}"/>
+ </war>
+ <au:assertLogContains text="Warning: selected war files include a second WEB-INF/web.xml which will be ignored."/>
+ </target>
</project>
Propchange: ant/core/branches/run-single-test-method/src/tests/antunit/taskdefs/xslt/printParams-invalid.xsl
('svn:mergeinfo' removed)
Propchange: ant/core/branches/run-single-test-method/src/tests/antunit/types/resources/comparators/test.xml
('svn:mergeinfo' removed)
Modified: ant/core/branches/run-single-test-method/src/tests/antunit/types/resources/concat-resource-test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/tests/antunit/types/resources/concat-resource-test.xml?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/tests/antunit/types/resources/concat-resource-test.xml (original)
+++ ant/core/branches/run-single-test-method/src/tests/antunit/types/resources/concat-resource-test.xml Mon May 3 17:44:21 2010
@@ -125,4 +125,18 @@ baz
</and>
</au:assertTrue>
</target>
+
+ <target name="testNonexistent">
+ <au:assertTrue>
+ <resourcesmatch>
+ <string>foobar</string>
+ <concat>
+ <string>foo</string>
+ <propertyresource name="someunsetproperty" />
+ <string>bar</string>
+ </concat>
+ </resourcesmatch>
+ </au:assertTrue>
+ </target>
+
</project>
Modified: ant/core/branches/run-single-test-method/src/tests/antunit/types/resources/test.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/tests/antunit/types/resources/test.xml?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/tests/antunit/types/resources/test.xml (original)
+++ ant/core/branches/run-single-test-method/src/tests/antunit/types/resources/test.xml Mon May 3 17:44:21 2010
@@ -15,8 +15,9 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<project default="all" xmlns:au="antlib:org.apache.ant.antunit"
- xmlns:rsel="antlib:org.apache.tools.ant.types.resources.selectors">
+<project default="antunit" xmlns:au="antlib:org.apache.ant.antunit">
+
+ <import file="../../antunit-base.xml" />
<property name="dirname" value="work" />
<property name="dir" location="${dirname}" />
@@ -351,6 +352,16 @@
</au:assertTrue>
</target>
+ <target name="testPropertyResolvedAsResource">
+ <string id="s" value="abcdefghij" />
+ <au:assertTrue>
+ <resourcesmatch>
+ <resource refid="s" />
+ <propertyresource name="ant.refid:s" />
+ </resourcesmatch>
+ </au:assertTrue>
+ </target>
+
<target name="testfirst0">
<au:assertTrue>
<resourcecount count="0">
Modified: ant/core/branches/run-single-test-method/src/tests/junit/org/apache/tools/ant/BuildFileTest.java
URL: http://svn.apache.org/viewvc/ant/core/branches/run-single-test-method/src/tests/junit/org/apache/tools/ant/BuildFileTest.java?rev=940531&r1=940530&r2=940531&view=diff
==============================================================================
--- ant/core/branches/run-single-test-method/src/tests/junit/org/apache/tools/ant/BuildFileTest.java (original)
+++ ant/core/branches/run-single-test-method/src/tests/junit/org/apache/tools/ant/BuildFileTest.java Mon May 3 17:44:21 2010
@@ -428,8 +428,12 @@ public abstract class BuildFileTest exte
*
* @param property property name
*/
- public void assertPropertyUnset(String property) {
- assertPropertyEquals(property, null);
+ public void assertPropertyUnset(String property) {
+ String result = project.getProperty(property);
+ if (result != null) {
+ fail("Expected property " + property
+ + " to be unset, but it is set to the value: " + result);
+ }
}
/**