Return-Path: Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 38449 invoked from network); 7 Dec 1999 14:44:18 -0000 Received: from taz.hyperreal.org (HELO hyperreal.org) (209.133.83.16) by 63.211.145.10 with SMTP; 7 Dec 1999 14:44:18 -0000 Received: (qmail 19429 invoked from network); 7 Dec 1999 14:44:16 -0000 Received: from fep7-old.mail.ozemail.net (HELO fep7.mail.ozemail.net) (203.2.192.99) by apache.org with SMTP; 7 Dec 1999 14:44:16 -0000 Received: from cognetnt (slsdn36p55.ozemail.com.au [210.84.1.56]) by fep7.mail.ozemail.net (8.9.0/8.6.12) with SMTP id BAA25703 for ; Wed, 8 Dec 1999 01:44:10 +1100 (EST) From: "Conor MacNeill" To: Subject: RE: omission of items attribute in jar taskdef (ant) Date: Wed, 8 Dec 1999 01:43:38 +1100 Message-ID: <001f01bf40c1$728492e0$80dc1fcb@cognetnt.cognet.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3612.1700 Importance: Normal In-Reply-To: > > Take a look at the Zip taskdef and rip my code out of there. I > was going to > do this for the Jar one, but was going to wait until I had more > time to deal > with it in the proper way...which is to make a more generic file utility > class instead of having all this duplicated code in each taskdef. > > -jon > > Actually I have just changed the Jar class to extend Zip. I made most of the methods in Zip protected and added an initZipOutputStream. In Zip this is just implemented as protected void initZipOutputStream(ZipOutputStream zOut) throws IOException, BuildException { zOut.setMethod(ZipOutputStream.DEFLATED); } but in Jar it is implemented as protected void initZipOutputStream(ZipOutputStream zOut) throws IOException, BuildException { zOut.setMethod(ZipOutputStream.DEFLATED); // add manifest first if (manifest != null) { ZipEntry ze = new ZipEntry("META-INF/"); zOut.putNextEntry(ze); zipFile(manifest, zOut, "META-INF/MANIFEST.MF"); } else { ZipEntry ze = new ZipEntry("META-INF/"); zOut.putNextEntry(ze); String s = "/org/apache/tools/ant/defaultManifest.mf"; InputStream in = this.getClass().getResourceAsStream(s); if ( in == null ) throw new BuildException ( "Could not find: " + s ); else zipFile(in, zOut, "META-INF/MANIFEST.MF"); } } Most of the methods in Jar disappear. I noticed that zipDir does not create the directory entries whereas the Jar equivalent, jarDir, did. I have preserved this behaviour by overriding zipDir in Jar. I'm not sure if this difference is required, but if not then Jar.java could become even smaller. I'd provide you with diffs but CVS appears to be down at the moment Cheers -- Conor MacNeill conor@m64.com M64 Pty Limited