[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug classpath/23854] New: ZipEntry handles additional timestamp in zip-
From: |
martin at egholm-nielsen dot dk |
Subject: |
[Bug classpath/23854] New: ZipEntry handles additional timestamp in zip-file incorrectly |
Date: |
13 Sep 2005 08:51:26 -0000 |
A zip-file created with cygwin's "zip" command contains an additional timestamp
entry for the modification-date. However, this timestamp is in seconds since the
UNIX epoch. However, ZipEntry interprets this a dostime, so when getTime() is
invoked, a wrong number is returned.
See the discussion thread on:
http://gcc.gnu.org/ml/java/2005-09/msg00070.html
A sample source illustrating it is given below, and the output is shown below
when tested on two zip-files - one created with cygwin's zip, and one with
WinZip:
=== GCJ ===
# ./zipdates fromzip.zip
ZipDates.java date: 313906034000 Thu Dec 13 03:07:14 GMT-01:00 1979
# ./zipdates fromwinzip.zip
ZipDates.java date: 1126270914231 Fri Sep 09 12:01:54 GMT-01:00 2005
The test-application is compiled using GCJ, and is confirmed by Ranjit Mathew to
be present in a "recent" version.
I'll attach the two zip-files...
=== ZipDates ===
/*
* Feel free to use this source.
* Martin Egholm - 2005.
*/
package men.zipdate;
import java.io.IOException;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
public class ZipDates
{
public static void main(String[] args) throws IOException
{
if (args.length < 1)
{
System.out.println("Missing filename argument...");
return;
} // if
else
{
ZipFile zf = new ZipFile(args[0]);
Enumeration entries = zf.entries();
while (entries.hasMoreElements())
{
ZipEntry entry = (ZipEntry) entries.nextElement();
System.out.println(entry.getName() + "\tdate: " + entry.getTime()
+ "\t" + new java.util.Date(entry.getTime()));
} // while
} // else
} // main
} // ZipDates
--
Summary: ZipEntry handles additional timestamp in zip-file
incorrectly
Product: classpath
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: classpath
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: martin at egholm-nielsen dot dk
CC: bug-classpath at gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23854
- [Bug classpath/23854] New: ZipEntry handles additional timestamp in zip-file incorrectly,
martin at egholm-nielsen dot dk <=