You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Chris Nokleberg <ch...@sixlegs.com> on 2002/08/13 08:59:10 UTC

[PATCH] Fix broken checksum fileset handling

After much hand-wringing I have discovered that checksums are broken
under the following conditions:

 (using verifyproperty OR in a condition) AND using filesets with
  multiple files

The property/condition is set/true based on the checksum of the last
file in the fileset, not the logical AND over all the files. This was
verified by looking at the latest CVS source.

I've included a simple patch that works for me.

-Chris

Index: Checksum.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Checksum.java,v
retrieving revision 1.26
diff -u -r1.26 Checksum.java
--- Checksum.java	25 Jul 2002 15:21:04 -0000	1.26
+++ Checksum.java	13 Aug 2002 06:51:20 -0000
@@ -398,7 +398,8 @@
                 if (destination instanceof java.lang.String) {
                     String prop = (String) destination;
                     if (isCondition) {
-                        checksumMatches = checksum.equals(property);
+                        checksumMatches = checksumMatches &&
+                            checksum.equals(property);
                     } else {
                         getProject().setNewProperty(prop, checksum);
                     }
@@ -414,7 +415,7 @@
                             fis = null;
                             br.close();
                             isr.close();
-                            checksumMatches =
+                            checksumMatches = checksumMatches &&
                                 checksum.equals(suppliedChecksum);
                         } else {
                             checksumMatches = false;

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>