ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject Pb with <unzip>+<trycatch>+<delete>
Date Tue, 16 Mar 2004 16:01:18 GMT
I have 2 independent CruiseControl builds: one write help zip files
to a server somewhere, while the other reads them when it detects changes
when it wakes up. There a inherent concurrency issue / race condition in
this scenario, which I try to address with the Ant code below.

    <unzip src="helpzipfiles/" dest="built/image/help" />
    <!-- Bad/incomplete zip. Remove it, so its redownloaded by <get> -->
    <delete quiet="true">
      <fileset file="helpzipfiles/" />
    <fail>Failed to unzip helpzipfiles/</fail>

If I fail to unzip a file, I assume the file is bad, remove it, so that
the next time CruiseControl fires the Ant build, <get> redownloads the
zip file, hopefully complete by then.

The problem is that the <delete> *silently* fails to delete the file, as
the CruiseControl XML log shows! I checked the code of Expand, and it does
have a try/finally block, closing the ZipFile instance... Maybe it should
also attempt to close the InputStream it got from ZipFile directly too???
ZipFile is supposed to do that, but apparently it doesn't work.

I'm on Win2K, JDK 1.4.2, Ant 1.6.0.

Also, shouldn't the failure to remove a file be logged at WARNING level,
when <delete> cannot delete a file, rather than at DEBUG level only?

And if the ZipFile.close() method really throws an exception, instead of
simply ignoring it completely, shouldn't it be at least logged?!?!?!

Thanks, --DD

<task location="C:\acme\build.xml:372: "
      name="unzip" time="12 seconds">  <message priority="info"><![CDATA[
    Expanding: C:\acme\helpzipfiles\
          into C:\acme\built\image\help
<task location="C:\acme\build.xml:376: " name="delete" time="0 seconds"> 
  <message priority="info"><![CDATA[
    Deleting 1 files from C:\acme\helpzipfiles
  ]]></message>  <message priority="debug"><![CDATA[
    Deleting C:\acme\helpzipfiles\
  ]]></message>  <message priority="debug"><![CDATA[
    Unable to delete file C:\acme\helpzipfiles\

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message