Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 6893 invoked from network); 8 Oct 2004 16:41:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 8 Oct 2004 16:41:46 -0000 Received: (qmail 46054 invoked by uid 500); 8 Oct 2004 16:41:33 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 45907 invoked by uid 500); 8 Oct 2004 16:41:32 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 45893 invoked by uid 99); 8 Oct 2004 16:41:32 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from [213.94.219.177] (HELO corvil.com) (213.94.219.177) by apache.org (qpsmtpd/0.28) with ESMTP; Fri, 08 Oct 2004 09:41:32 -0700 Received: from [172.18.1.171] (angel.local.corvil.com [172.18.1.171]) by corvil.com (8.12.9/8.12.5) with ESMTP id i98GfPwS006705 for ; Fri, 8 Oct 2004 17:41:26 +0100 (IST) (envelope-from peterreilly@apache.org) Message-ID: <4166C386.3020105@apache.org> Date: Fri, 08 Oct 2004 17:42:46 +0100 From: Peter Reilly User-Agent: Mozilla Thunderbird 0.8 (X11/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ant Users List Subject: Re: AW: AW: how to fail on valid zip file References: <879A5AD5DD0ED511891F0003473A9B560E23F6E2@Z011004> <4166AFBA.2060406@magmic.com> In-Reply-To: <4166AFBA.2060406@magmic.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N You could do this: @{file} can be unzipped But this does generate a lot of noise: run: [mkdir] Created dir: /home/preilly/learning/a/try/tmp/ziptest [unzip] Expanding: /home/preilly/learning/a/try/x.zip into /home/preilly/learning/a/try/tmp/ziptest [ac:trycatch] Caught exception: Error while expanding /home/preilly/learning/a/try/x.zip [delete] Deleting directory /home/preilly/learning/a/try/tmp/ziptest So it may be better to write a custom task. Peter Jeffrey Bacon wrote: > here, unzip is throwing the exception and it's seemingly not getting > caught, do I need to explicitly catch the BuildException? (with a > block) > > Jeffrey Bacon > jbacon@magmic.com > Creative Developer > http://www.magmic.com > > Jan.Materne@rzf.fin-nrw.de wrote: > >> oh, yes - sorry. >> In JUnit you work with different Exceptions >> >> try { >> test... >> fail(); >> } catch (MyException) { >> // noop >> } >> >> The fail() itself throws an Exception ... >> >> Nothing different here, BUT we�re working only with BuildExceptions ... >> >> Jan >> >> >>> -----Urspr�ngliche Nachricht----- >>> Von: Jeffrey Bacon [mailto:jbacon@magmic.com] >>> Gesendet am: Freitag, 8. Oktober 2004 17:02 >>> An: Ant Users List >>> Betreff: Re: AW: how to fail on valid zip file >>> >>> It still fails on the invalid ZIP file (which I want it to succeed on): >>> >>> [mkdir] Created dir: C:\workspace\BreakFast\temp\ziptest >>> [unzip] Expanding: C:\workspace\BreakFast\bin\BreakFast_res.cod >>> into C:\workspace\BreakFast\temp\ziptest >>> [delete] Deleting directory C:\workspace\BreakFast\temp\ziptest >>> >>> BUILD FAILED >>> C:\workspace\BreakFast\build.xml:251: Following error occured while >>> executing this line >>> C:\workspace\BreakFast\build.xml:687: Error while expanding >>> C:\workspace\BreakFast\bin\BreakFast_res.cod >>> >>> >>> here's my code snippit: >>> >>> >>> >>> >>> >> src="${basedir}/${bin.dir}/${${project-name}.name}.cod" >>> dest="${basedir}/${temp.dir}/ziptest" /> >>> >>> >>> >>> >>> >>> >>> >>> >>> WARNING: ${${project-name}.name}.cod >>> is a sibling COD file which will not install OTA on a BES >>> <4.0 >>> >>> >>> >>> >>> >> quiet="true" >>> failonerror="false" >>> includeEmptyDirs="true" /> >>> >>> >>> >>> >>> Jeffrey Bacon >>> jbacon@magmic.com >>> Creative Developer >>> http://www.magmic.com >>> >>> Jan.Materne@rzf.fin-nrw.de wrote: >>> >>>> in unit tests you would do >>>> >>>> try { >>>> test... >>>> fail(); >>>> } catch { >>>> // fine >>>> } >>>> >>>> so you can use AntContrib for that >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> Jan >>>> >>>> > -----Urspr�ngliche Nachricht----- >>>> > Von: Jeffrey Bacon [mailto:jbacon@magmic.com] >>>> > Gesendet am: Freitag, 8. Oktober 2004 15:46 >>>> > An: Ant Users List >>>> > Betreff: how to fail on valid zip file >>>> > >>>> > During my build process, I want to test a file to see if it >>>> > is a valid >>>> > ZIP file. However, I want to FAIL if it IS valid and succeed >>>> > if it is >>>> > NOT valid. Is there some way I can do this with the unzip task? >>>> > -- >>>> > Jeffrey Bacon >>>> > jbacon@magmic.com >>>> > Creative Developer >>>> > http://www.magmic.com >>>> > >>>> > >>>> >>> >> > >------------------------------------------------------------------------ > >--------------------------------------------------------------------- >To unsubscribe, e-mail: user-unsubscribe@ant.apache.org >For additional commands, e-mail: user-help@ant.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org