ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Zip.java
Date Mon, 07 Jun 2004 12:26:03 GMT
bodewig     2004/06/07 05:26:03

  Modified:    .        WHATSNEW
               src/main/org/apache/tools/ant/taskdefs Zip.java
  Log:
  prevent empty archive in zip if whenempty is set to skip, PR: 22865
  
  Revision  Changes    Path
  1.618     +3 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.617
  retrieving revision 1.618
  diff -u -r1.617 -r1.618
  --- WHATSNEW	7 Jun 2004 12:05:40 -0000	1.617
  +++ WHATSNEW	7 Jun 2004 12:26:03 -0000	1.618
  @@ -136,6 +136,9 @@
   
   * <symlink> could create cyclic links.  Bugzilla Report 25181.
   
  +* <zip whenempty="skip"> didn't work in a common situation.  Bugzilla
  +  Report 22865.
  +
   Other changes:
   --------------
   * doc fix concerning the dependencies of the ftp task
  
  
  
  1.126     +10 -0     ant/src/main/org/apache/tools/ant/taskdefs/Zip.java
  
  Index: Zip.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Zip.java,v
  retrieving revision 1.125
  retrieving revision 1.126
  diff -u -r1.125 -r1.126
  --- Zip.java	25 May 2004 11:48:20 -0000	1.125
  +++ Zip.java	7 Jun 2004 12:26:03 -0000	1.126
  @@ -903,6 +903,12 @@
       protected Resource[][] grabResources(FileSet[] filesets) {
           Resource[][] result = new Resource[filesets.length][];
           for (int i = 0; i < filesets.length; i++) {
  +            boolean skipEmptyNames = true;
  +            if (filesets[i] instanceof ZipFileSet) {
  +                ZipFileSet zfs = (ZipFileSet) filesets[i];
  +                skipEmptyNames = zfs.getPrefix(getProject()).equals("")
  +                    && zfs.getFullpath(getProject()).equals("");
  +            }
               DirectoryScanner rs =
                   filesets[i].getDirectoryScanner(getProject());
               if (rs instanceof ZipScanner) {
  @@ -911,11 +917,15 @@
               Vector resources = new Vector();
               String[] directories = rs.getIncludedDirectories();
               for (int j = 0; j < directories.length; j++) {
  +                if (!"".equals(directories[0]) || !skipEmptyNames) {
                   resources.addElement(rs.getResource(directories[j]));
  +                }
               }
               String[] files = rs.getIncludedFiles();
               for (int j = 0; j < files.length; j++) {
  +                if (!"".equals(files[0]) || !skipEmptyNames) {
                   resources.addElement(rs.getResource(files[j]));
  +                }
               }
   
               result[i] = new Resource[resources.size()];
  
  
  

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


Mime
View raw message