ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject Questions regarding GUnzip and BUnzip2 extract methods.
Date Wed, 20 Jan 2010 17:13:58 GMT
Hello there,

I have a very specific question about some ant code, I hope this is the
correct place to post it.

I have been using part of the ant project to unGzip and unBzip2 files as
I wanted a Java way of doing this and I stumbled across the ant classes
that implement this.

Anyway I was experiencing a curious behavior of the classes and When the extract method is called
with files I was receiving from a Webserver nothing was happening. Upon
further investigation I noticed that my files were failing the check:


if (source.lastModified() > dest.lastModified()) {


It turned out that my source file had a lastModified =  0, so before
calling the extract method I would manually ensure that the modified
fields of the source and dest files were correct to pass this check.

 I was wondering though, what is the purpose or use case for this check?
And also, would it not be nice to have an exception thrown or some
logging when an extract is not attempted due to this check evaluating as
false? From looking at the code I cannot understand what the need is for
this check and furthermore why it should ever pass (if I create a new
Dest file and I am using an unmodified source file then surely
dest.lastModified > source.lastModified), so I am very intrigued as to
why it is used. Any information on this would be much appreciated.

Finally I would like to say that I have found the ant tool very useful
for deploying complex java projects to Glassfish etc and apart from this
strange behavior, resulting from files that have their lastModified
fields set incorrectly, that the Untar/GUnzip/BUnzip2 classes work very
well indeed and have been an excellent solution to my problem.




Scanned by iCritical.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message