ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeffrey Bacon <jba...@magmic.com>
Subject Re: AW: AW: how to fail on valid zip file
Date Fri, 08 Oct 2004 15:18:18 GMT
here, unzip is throwing the exception and it's seemingly not getting 
caught, do I need to explicitly catch the BuildException? (with a 
<catch> 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:
>>
>>     <contrib:trycatch>
>>       <contrib:try>
>>         <mkdir dir="${basedir}/${temp.dir}/ziptest" />
>>         <unzip 
>>src="${basedir}/${bin.dir}/${${project-name}.name}.cod" 
>>dest="${basedir}/${temp.dir}/ziptest" />
>>         <contrib:if>
>>           <contrib:not>
>>             <contrib:isset property="ignoreSiblingCODs" />
>>           </contrib:not>
>>           <contrib:then>
>>             <fail message="${${project-name}.name}.cod is a 
>>sibling COD 
>>file which will not install OTA on a BES &lt;4.0" />
>>           </contrib:then>
>>           <contrib:else>
>>             <echo level="warn">WARNING: 
>>${${project-name}.name}.cod is 
>>a sibling COD file which will not install OTA on a BES &lt;4.0</echo>
>>           </contrib:else>
>>         </contrib:if>
>>       </contrib:try>
>>       <contrib:finally>
>>         <delete dir="${basedir}/${temp.dir}/ziptest"
>>                 quiet="true"
>>                 failonerror="false"
>>                 includeEmptyDirs="true" />
>>       </contrib:finally>
>>     </contrib:trycatch>
>>
>>
>>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
>>>
>>><trycatch>
>>>    <try>
>>>        <unzip/>
>>>        <fail/>
>>>    </try>
>>></trycatch>
>>>
>>>
>>>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
>>> >
>>> >
>>>
>>
> 


Mime
View raw message