Don't merge Class-Path attributes, deal with them like with any other

attribute - except that they may occur several times, that is.

PR: 21170


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274780 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stefan Bodewig 2003-07-07 08:18:39 +00:00
parent b3daf333da
commit 3341571e8e
2 changed files with 19 additions and 4 deletions

View File

@ -39,6 +39,10 @@ Changes that could break older environments:
defined in the project. If you rely on the task waiting for input, defined in the project. If you rely on the task waiting for input,
don't use the addproperty attribute. don't use the addproperty attribute.
* The Class-Path attribute in manifests will no longer merge the
entries of all manifests found, but will be treated like all other
manifest attributes - the most recent attribute(s) will be used.
Fixed bugs: Fixed bugs:
----------- -----------
* Filter readers were not handling line endings properly. Bugzilla * Filter readers were not handling line endings properly. Bugzilla
@ -182,6 +186,9 @@ Fixed bugs:
* Nested websphere element for ejbjar does not support spaces in file name. * Nested websphere element for ejbjar does not support spaces in file name.
Bugzilla Report 21298 Bugzilla Report 21298
* Don't multiply Class-Path attributes when updating jars. Bugzilla
Report 21170.
Other changes: Other changes:
-------------- --------------
* Six new Clearcase tasks added. * Six new Clearcase tasks added.

View File

@ -459,16 +459,19 @@ public class Manifest {
} }
Enumeration e = section.getAttributeKeys(); Enumeration e = section.getAttributeKeys();
Attribute classpathAttribute = null;
while (e.hasMoreElements()) { while (e.hasMoreElements()) {
String attributeName = (String) e.nextElement(); String attributeName = (String) e.nextElement();
Attribute attribute = section.getAttribute(attributeName); Attribute attribute = section.getAttribute(attributeName);
if (attributeName.equals(ATTRIBUTE_CLASSPATH) && if (attributeName.equals(ATTRIBUTE_CLASSPATH)) {
attributes.containsKey(attributeName)) { if (classpathAttribute == null) {
Attribute ourClassPath = getAttribute(attributeName); classpathAttribute = new Attribute();
classpathAttribute.setName(ATTRIBUTE_CLASSPATH);
}
Enumeration cpe = attribute.getValues(); Enumeration cpe = attribute.getValues();
while (cpe.hasMoreElements()) { while (cpe.hasMoreElements()) {
String value = (String) cpe.nextElement(); String value = (String) cpe.nextElement();
ourClassPath.addValue(value); classpathAttribute.addValue(value);
} }
} else { } else {
// the merge file always wins // the merge file always wins
@ -476,6 +479,11 @@ public class Manifest {
} }
} }
if (classpathAttribute != null) {
// the merge file *always* wins, even for Class-Path
storeAttribute(classpathAttribute);
}
// add in the warnings // add in the warnings
Enumeration warnEnum = section.warnings.elements(); Enumeration warnEnum = section.warnings.elements();
while (warnEnum.hasMoreElements()) { while (warnEnum.hasMoreElements()) {