You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2006/05/24 22:40:21 UTC
DO NOT REPLY [Bug 39655] New: - Manifest task does not merge Class-Path in update mode and overwrites the old contents
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39655>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39655
Summary: Manifest task does not merge Class-Path in update mode
and overwrites the old contents
Product: Ant
Version: 1.6.5
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Core tasks
AssignedTo: dev@ant.apache.org
ReportedBy: vassilis.touloumtzoglou@gmail.com
the mode="update" the manifest task is supposed to merge sections of manifest properties including
the main section.
There seems to be some code to handle the Class-Path attribute separately but guess what, it doesn't
work...
There's discussion that multiple Class-Path attributes should be supported but the utility of this feature
is questionable. Ideally an attribute should be added to disambiguate the bahaviour of the Manifest
task (something like multipleClasspathProps="true|false" should do).
In the meantime here's my fix for this:
--- main/org/apache/tools/ant/taskdefs/Manifest.java 2005-06-02 15:19:58.000000000 +0200
+++ /Volumes/vassilistouloumtzoglou/dev/workspace/apache-ant/src/main/org/apache/tools/ant/
taskdefs/Manifest.java 2006-05-15 21:08:35.000000000 +0200
@@ -430,11 +430,19 @@
if (classpathAttribute == null) {
classpathAttribute = new Attribute();
classpathAttribute.setName(ATTRIBUTE_CLASSPATH);
+ if (getAttribute(ATTRIBUTE_CLASSPATH) != null) {
+ for (Enumeration attribEnum = getAttribute(ATTRIBUTE_CLASSPATH).getValues();
attribEnum.hasMoreElements();) {
+ String value = (String)attribEnum.nextElement();
+ String previousValue = (classpathAttribute.getValue() != null ?
classpathAttribute.getValue() : "");
+ classpathAttribute.setValue(previousValue + " " + value);
+ }
+ }
}
Enumeration cpe = attribute.getValues();
while (cpe.hasMoreElements()) {
String value = (String) cpe.nextElement();
- classpathAttribute.addValue(value);
+ String previousValue = (classpathAttribute.getValue() != null ?
classpathAttribute.getValue() : "");
+ classpathAttribute.setValue(previousValue + " " + value);
}
} else {
// the merge file always wins
@@ -629,7 +637,12 @@
return;
}
String attributeKey = attribute.getKey();
- attributes.put(attributeKey, attribute);
+ if (attributes.contains(attributeKey)) {
+ Attribute principalAttribute = (Attribute)attributes.get(attributeKey);
+ principalAttribute.addValue(attribute.getValue());
+ } else {
+ attributes.put(attributeKey, attribute);
+ }
if (!attributeIndex.contains(attributeKey)) {
attributeIndex.addElement(attributeKey);
}
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
DO NOT REPLY [Bug 39655] - Manifest task does not merge Class-Path in update mode and overwrites the old contents
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39655>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39655
------- Additional Comments From vassilis.touloumtzoglou@gmail.com 2006-05-24 20:43 -------
Created an attachment (id=18349)
--> (http://issues.apache.org/bugzilla/attachment.cgi?id=18349&action=view)
main/org/apache/tools/ant/taskdefs/Manifest.java
main/org.apache.tools.ant.taskdefs.Manifest.java patch
It's a core task so it's in ant.jar
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org