You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2003/07/07 10:18:39 UTC

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Manifest.java

bodewig     2003/07/07 01:18:39

  Modified:    .        WHATSNEW
               src/main/org/apache/tools/ant/taskdefs Manifest.java
  Log:
  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
  
  Revision  Changes    Path
  1.452     +7 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.451
  retrieving revision 1.452
  diff -u -r1.451 -r1.452
  --- WHATSNEW	3 Jul 2003 21:48:43 -0000	1.451
  +++ WHATSNEW	7 Jul 2003 08:18:38 -0000	1.452
  @@ -39,6 +39,10 @@
     defined in the project.  If you rely on the task waiting for input,
     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:
   -----------
   * Filter readers were not handling line endings properly.  Bugzilla
  @@ -181,6 +185,9 @@
   
   * Nested websphere element for ejbjar does not support spaces in file name.
     Bugzilla Report 21298
  +
  +* Don't multiply Class-Path attributes when updating jars.  Bugzilla
  +  Report 21170.
   
   Other changes:
   --------------
  
  
  
  1.43      +12 -4     ant/src/main/org/apache/tools/ant/taskdefs/Manifest.java
  
  Index: Manifest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Manifest.java,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- Manifest.java	6 Jul 2003 09:57:36 -0000	1.42
  +++ Manifest.java	7 Jul 2003 08:18:39 -0000	1.43
  @@ -459,21 +459,29 @@
               }
   
               Enumeration e = section.getAttributeKeys();
  +            Attribute classpathAttribute = null;
               while (e.hasMoreElements()) {
                   String attributeName = (String) e.nextElement();
                   Attribute attribute = section.getAttribute(attributeName);
  -                if (attributeName.equals(ATTRIBUTE_CLASSPATH) &&
  -                        attributes.containsKey(attributeName)) {
  -                    Attribute ourClassPath = getAttribute(attributeName);
  +                if (attributeName.equals(ATTRIBUTE_CLASSPATH)) {
  +                    if (classpathAttribute == null) {
  +                        classpathAttribute = new Attribute();
  +                        classpathAttribute.setName(ATTRIBUTE_CLASSPATH);
  +                    }
                       Enumeration cpe = attribute.getValues();
                       while (cpe.hasMoreElements()) {
                           String value = (String) cpe.nextElement();
  -                        ourClassPath.addValue(value);
  +                        classpathAttribute.addValue(value);
                       }
                   } else {
                       // the merge file always wins
                       storeAttribute(attribute);
                   }
  +            }
  +
  +            if (classpathAttribute != null) {
  +                // the merge file *always* wins, even for Class-Path
  +                storeAttribute(classpathAttribute);
               }
   
               // add in the warnings
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Manifest.java

Posted by Stefan Bodewig <bo...@apache.org>.
On 7 Jul 2003, <bo...@apache.org> wrote:

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

This breaks backwards compatibility and has been recorded as such.  I
think the old behavior is a bug.

I didn't implement a warning like "You manifest contains multiple
Class-Path entries, using the jar with JDK 1.4.2 will result in
warnings.", yet. I wasn't sure whether it would be a good idea to add
that at all - and where to put it.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org