diff --git a/WHATSNEW b/WHATSNEW
index 75010cf3a..613972d17 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -749,6 +749,10 @@ Other changes:
optional prefix and suffix attributes.
Bugzilla Report 45625
+ * "add"
.
"add"
.
false.Doesn't have any effect if index is false.
+ * + *Sun's jar implementation used to skip the META-INF directory + * and Ant followed that example. The behavior has been changed + * with Java 5. In order to avoid problems with Ant generated + * jars on Java 1.4 or earlier Ant will not include META-INF + * unless explicitly asked to.
+ * + * @see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4408526 + * @since Ant 1.8.0 + * @param flag aboolean
value, defaults to false
+ */
+ public void setIndexMetaInf(boolean flag) {
+ indexMetaInf = flag;
+ }
+
/**
* The character encoding to use in the manifest file.
*
@@ -972,7 +994,9 @@ public class Jar extends Zip {
// looks like nothing from META-INF should be added
// and the check is not case insensitive.
// see sun.misc.JarIndex
- if (dir.startsWith("META-INF")) {
+ // see also
+ // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4408526
+ if (!indexMetaInf && dir.startsWith("META-INF")) {
continue;
}
// name newline
@@ -1064,9 +1088,6 @@ public class Jar extends Zip {
org.apache.tools.zip.ZipEntry ze =
(org.apache.tools.zip.ZipEntry) entries.nextElement();
String name = ze.getName();
- // META-INF would be skipped anyway, avoid index for
- // manifest-only jars.
- if (!name.startsWith("META-INF/")) {
if (ze.isDirectory()) {
dirSet.add(name);
} else if (name.indexOf("/") == -1) {
@@ -1079,7 +1100,6 @@ public class Jar extends Zip {
dirSet.add(name.substring(0,
name.lastIndexOf("/") + 1));
}
- }
}
dirs.addAll(dirSet);
} finally {
diff --git a/src/tests/antunit/taskdefs/jar-test.xml b/src/tests/antunit/taskdefs/jar-test.xml
index bee7a6601..6678ef2f6 100644
--- a/src/tests/antunit/taskdefs/jar-test.xml
+++ b/src/tests/antunit/taskdefs/jar-test.xml
@@ -60,4 +60,30 @@