bodewig 2002/10/04 06:07:14
Modified: . Tag: ANT_15_BRANCH WHATSNEW
src/etc/testcases/taskdefs Tag: ANT_15_BRANCH manifest.xml
src/main/org/apache/tools/ant/taskdefs Tag: ANT_15_BRANCH
Manifest.java
src/testcases/org/apache/tools/ant/taskdefs Tag:
ANT_15_BRANCH ManifestTest.java
Log:
Merge fix for PR 12440 from HEAD
Revision Changes Path
No revision
No revision
1.263.2.86 +6 -0 jakarta-ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
retrieving revision 1.263.2.85
retrieving revision 1.263.2.86
diff -u -r1.263.2.85 -r1.263.2.86
--- WHATSNEW 4 Oct 2002 08:39:17 -0000 1.263.2.85
+++ WHATSNEW 4 Oct 2002 13:07:14 -0000 1.263.2.86
@@ -1,6 +1,12 @@
Changes from Ant 1.5.1 to current CVS version
=============================================
+Fixed bugs:
+-----------
+
+* <manifest> wouldn't update an existing manifest if only an attribute
+ of an existing section changed.
+
Changes from Ant 1.5.1Beta1 to 1.5.1
====================================
No revision
No revision
1.5.2.2 +12 -0 jakarta-ant/src/etc/testcases/taskdefs/manifest.xml
Index: manifest.xml
===================================================================
RCS file: /home/cvs/jakarta-ant/src/etc/testcases/taskdefs/manifest.xml,v
retrieving revision 1.5.2.1
retrieving revision 1.5.2.2
diff -u -r1.5.2.1 -r1.5.2.2
--- manifest.xml 21 May 2002 12:59:06 -0000 1.5.2.1
+++ manifest.xml 4 Oct 2002 13:07:14 -0000 1.5.2.2
@@ -188,6 +188,18 @@
<manifest file="mftest.mf" mode="update">
<attribute name="Foo" value="Bar" />
</manifest>
+
+ <copy file="manifests/test2.mf" toFile="mftest2.mf" />
+ <manifest file="mftest2.mf" mode="update">
+ <section name="Test">
+ <attribute name="Foo" value="Bar" />
+ </section>
+ </manifest>
+ <manifest file="mftest2.mf" mode="update">
+ <section name="Test">
+ <attribute name="Foo" value="Baz" />
+ </section>
+ </manifest>
</target>
<target name="clean">
No revision
No revision
1.33.2.6 +20 -2
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Manifest.java
Index: Manifest.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Manifest.java,v
retrieving revision 1.33.2.5
retrieving revision 1.33.2.6
diff -u -r1.33.2.5 -r1.33.2.6
--- Manifest.java 4 Jul 2002 14:54:42 -0000 1.33.2.5
+++ Manifest.java 4 Oct 2002 13:07:14 -0000 1.33.2.6
@@ -628,6 +628,24 @@
}
/**
+ * Clone this section
+ *
+ * @since Ant 1.5.2
+ */
+ public Object clone() {
+ Section cloned = new Section();
+ cloned.setName(name);
+ Enumeration e = getAttributeKeys();
+ while (e.hasMoreElements()) {
+ String key = (String) e.nextElement();
+ Attribute attribute = getAttribute(key);
+ cloned.storeAttribute(new Attribute(attribute.getName(),
+ attribute.getValue()));
+ }
+ return cloned;
+ }
+
+ /**
* Store an attribute and update the index.
*
* @param attribute the attribute to be stored
@@ -843,7 +861,7 @@
throws ManifestException {
if (other != null) {
if (overwriteMain) {
- mainSection = other.mainSection;
+ mainSection = (Section) other.mainSection.clone();
} else {
mainSection.merge(other.mainSection);
}
@@ -860,7 +878,7 @@
= (Section) other.sections.get(sectionName);
if (ourSection == null) {
if (otherSection != null) {
- addConfiguredSection(otherSection);
+ addConfiguredSection((Section)
otherSection.clone());
}
} else {
ourSection.merge(otherSection);
No revision
No revision
1.7.2.1 +7 -0
jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/ManifestTest.java
Index: ManifestTest.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/ManifestTest.java,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -r1.7 -r1.7.2.1
--- ManifestTest.java 20 Mar 2002 12:11:57 -0000 1.7
+++ ManifestTest.java 4 Oct 2002 13:07:14 -0000 1.7.2.1
@@ -315,6 +315,13 @@
assertNotNull(mfAsString);
assertTrue(mfAsString.startsWith("Manifest-Version: 2.0"));
assertTrue(mfAsString.indexOf("Foo: Bar") > -1);
+
+ mf = getManifest("src/etc/testcases/taskdefs/mftest2.mf");
+ assertNotNull(mf);
+ mfAsString = mf.toString();
+ assertNotNull(mfAsString);
+ assertEquals(-1, mfAsString.indexOf("Foo: Bar"));
+ assertTrue(mfAsString.indexOf("Foo: Baz") > -1);
}
/**
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>