Return-Path: Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 68089 invoked from network); 20 Feb 2001 07:29:55 -0000 Received: from smtp2.san.rr.com (24.25.195.39) by h31.sny.collab.net with SMTP; 20 Feb 2001 07:29:55 -0000 Received: from looper ([204.210.14.39]) by smtp2.san.rr.com (Post.Office MTA v3.5.3 release 223 ID# 0-0U10L2S100V35) with SMTP id com for ; Mon, 19 Feb 2001 23:26:39 -0800 From: David Rees To: ant-dev@jakarta.apache.org Subject: [PATCH] Bug 564 Date: Mon, 19 Feb 2001 23:21:41 -0800 Message-ID: X-Mailer: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N Patches to fix Bug 564 (as per updated Bugzilla comments): Correct typo in new Zip test case (tar -> zip) Add Zip test case for zipping target when target file doesn't already exist Zip task patched to properly catch additional test case Index: jakarta-ant/src/etc/testcases/taskdefs/zip.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/cvspublic/jakarta-ant/src/etc/testcases/taskdefs/zip.xml,v retrieving revision 1.2.2.1 diff -u -r1.2.2.1 zip.xml --- jakarta-ant/src/etc/testcases/taskdefs/zip.xml 2001/02/19 13:30:06 1.2.2.1 +++ jakarta-ant/src/etc/testcases/taskdefs/zip.xml 2001/02/20 07:20:36 @@ -10,13 +10,24 @@ =20 + - - =20 - =20 + + + + + + + + + Index: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.ja= va,v retrieving revision 1.30.2.1 diff -u -r1.30.2.1 Zip.java --- jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java 2001/02/19 13:30:07 1.30.2.1 +++ jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java 2001/02/20 07:20:37 @@ -334,12 +334,6 @@ return true; } } else { - for (int i =3D 0; i < files.length; ++i) { - if (files[i].equals(zipFile)) { - throw new BuildException("A zip file cannot include itself", location); - } - } - if (!zipFile.exists()) return false; =20 SourceFileScanner sfs =3D new SourceFileScanner(this); @@ -465,6 +459,10 @@ protected void zipFile(File file, ZipOutputStream zOut, String vPath) throws IOException { + if (file.equals(zipFile)) { + throw new BuildException("A zip file cannot include itself", location); + } + FileInputStream fIn =3D new FileInputStream(file); try { zipFile(fIn, zOut, vPath, file.lastModified()); Index: jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/ZipTest.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/cvspublic/jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/Z= ipTest.java,v retrieving revision 1.2.2.1 diff -u -r1.2.2.1 ZipTest.java --- jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/ZipTest.java 2001/02/19 13:30:07 1.2.2.1 +++ jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/ZipTest.java 2001/02/20 07:20:39 @@ -78,6 +78,10 @@ public void test3() {=20 expectBuildException("test3", "zip cannot include itself"); } + + public void test4() {=20 + expectBuildException("test4", "zip cannot include itself"); + } =20 public void tearDown() { executeTarget("cleanup");