ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Iulian Musat <iul...@cst.ro>
Subject bug with "tar" task
Date Wed, 07 Jun 2000 09:55:55 GMT
Hello everybody!


I found a bug related to building tar files with tar task.

In org.apache.tools.ant.taskdefs.Tar:

    protected void tarFile(File file, TarOutputStream tOut, String
vPath)
        throws IOException
    {
	[....]
        te.setModTime(file.lastModified() / 1000);
	[...]
    }

The return of lastModified is divided by 1000 to translate milliseconds
to seconds, but
org.apache.tools.ant.tar.TarEntry.setModTime expect a Java time (in
milliseconds) also:
    public void setModTime(long time) {
        this.modTime  = time / 1000;
    }   

Fixed:
in org.apache.tools.ant.taskdefs.Tar.tarFile remove the "/ 1000".

Suggestion:
Probably a function to translate Java time to unix time will be a good
idea (take a look into org.apache.tools.ant.tar.TarEntry: there are a
lot of "/ 1000" :-)

Thank you.

Mime
View raw message