From: Rang, C. <Chr...@ge...> - 2005-08-26 12:58:52
|
The ZipEntry.setTime() method is implemented as follows: public void setTime(long time) { Calendar cal = getCalendar(); synchronized (cal) { cal.setTime(new Date(time*1000L)); dostime = (cal.get(Calendar.YEAR) - 1980 & 0x7f) << 25 | (cal.get(Calendar.MONTH) + 1) << 21 | (cal.get(Calendar.DAY_OF_MONTH)) << 16 | (cal.get(Calendar.HOUR_OF_DAY)) << 11 | (cal.get(Calendar.MINUTE)) << 5 | (cal.get(Calendar.SECOND)) >> 1; } dostime = (int) (dostime / 1000L); this.known |= KNOWN_TIME; } Questions: -> Why is the 'time' parameter multiplied by 1000 for the Date constructor? According to the original java.util.zip documentation, the parameter is already in milliseconds, as required by the Date() ctor. -> Why is the resulting dostime divided by 1000 again at the end? I did some tests and loaded the resulting ZIP with WinZIP, and the WinZIP test resulted in: Teste ... Bei Datei "xxx.txt" ist das Verzeichnisdatum zentral falsch. Stattdessen wird das aktuelle Systemdatum verwendet. Bei Datei "xxx.txt" ist das Verzeichnisdatum lokal falsch. Stattdessen wird das aktuelle Systemdatum verwendet. Teste: xxx.txt OK Es wurde mindestens ein Warnung --Fehler in xxx.zip entdeckt. Sorry - it's a german ZIP version. The error messages mean roughly translated that the timestamp (central) and the timestamp (local) is wrong, and that winzip uses the current system time instead. When I removed the '*1000' in the Date ctor call and the dosttime=dostime/1000, all worked perfectly - WinZip did no longer issue warnings and displayed the actual date of the file that was zipped. |
From: Christian S. <chr...@sc...> - 2005-08-27 09:59:23
Attachments:
smime.p7s
|
Hi, these and many other issues have been addressed by a bigger patch which I've submitted back in February or March. Unfortunately, jazzlib seems to be abandoned at the moment, so the patch wasn't picked up. If you're looking for a ZIP package with advanced features and backwards compatibility to the JDK, please have a look at http://truezip.dev.java.net. This will allow you to use umlauts in ZIP entries as well. With best regards, Christian Schlichtherle --- Schlichtherle IT Services Wittelsbacher Str. 10a 10707 Berlin Mobil: 0173 / 27 12 470 mailto:chr...@sc... http://www.schlichtherle.de > -----Original Message----- > From: jaz...@li... > [mailto:jaz...@li...] On > Behalf Of Rang, Christian > Sent: Friday, August 26, 2005 2:59 PM > To: 'jaz...@li...' > Subject: [Jazzlib-developers] ZipEntry.setTime() Bug in > Jazzlib 0.0.7 ? > > The ZipEntry.setTime() method is implemented as follows: > > public void setTime(long time) > { > Calendar cal = getCalendar(); > synchronized (cal) > { > cal.setTime(new Date(time*1000L)); > dostime = (cal.get(Calendar.YEAR) - 1980 & 0x7f) << 25 > | (cal.get(Calendar.MONTH) + 1) << 21 > | (cal.get(Calendar.DAY_OF_MONTH)) << 16 > | (cal.get(Calendar.HOUR_OF_DAY)) << 11 > | (cal.get(Calendar.MINUTE)) << 5 > | (cal.get(Calendar.SECOND)) >> 1; > } > dostime = (int) (dostime / 1000L); > this.known |= KNOWN_TIME; > } > > Questions: > -> Why is the 'time' parameter multiplied by 1000 for the > Date constructor? > According to the original java.util.zip documentation, the > parameter is already in milliseconds, as required by the Date() ctor. > -> Why is the resulting dostime divided by 1000 again at the end? > > I did some tests and loaded the resulting ZIP with WinZIP, > and the WinZIP test resulted in: > > Teste ... > Bei Datei "xxx.txt" ist das Verzeichnisdatum zentral falsch. > Stattdessen wird das aktuelle Systemdatum verwendet. > Bei Datei "xxx.txt" ist das Verzeichnisdatum lokal falsch. > Stattdessen wird das aktuelle Systemdatum verwendet. > Teste: xxx.txt OK > Es wurde mindestens ein Warnung --Fehler in xxx.zip entdeckt. > > Sorry - it's a german ZIP version. The error messages mean > roughly translated that the timestamp (central) and the > timestamp (local) is wrong, and that winzip uses the current > system time instead. > > When I removed the '*1000' in the Date ctor call and the > dosttime=dostime/1000, all worked perfectly - WinZip did no > longer issue warnings and displayed the actual date of the > file that was zipped. > > > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & > EXPO September 19-22, 2005 * San Francisco, CA * Development > Lifecycle Practices Agile & Plan-Driven Development * > Managing Projects & Teams * Testing & QA Security * Process > Improvement & Measurement * http://www.sqe.com/bsce5sf > _______________________________________________ > Jazzlib-developers mailing list > Jaz...@li... > https://lists.sourceforge.net/lists/listinfo/jazzlib-developers |
From: John L. <je...@pi...> - 2005-08-27 11:22:28
|
> these and many other issues have been addressed by a bigger patch which I've > submitted back in February or March. Unfortunately, jazzlib seems to be > abandoned at the moment, so the patch wasn't picked up. One of the Classpath developers needs to take a look at your patches (or maybe you could request CVS access). You can try asking on the mailing list again. John Leuner > If you're looking for a ZIP package with advanced features and backwards > compatibility to the JDK, please have a look at http://truezip.dev.java.net. > This will allow you to use umlauts in ZIP entries as well. > > With best regards, > Christian Schlichtherle > --- > Schlichtherle IT Services > Wittelsbacher Str. 10a > 10707 Berlin > > Mobil: 0173 / 27 12 470 > mailto:chr...@sc... > http://www.schlichtherle.de > > > > -----Original Message----- > > From: jaz...@li... > > [mailto:jaz...@li...] On > > Behalf Of Rang, Christian > > Sent: Friday, August 26, 2005 2:59 PM > > To: 'jaz...@li...' > > Subject: [Jazzlib-developers] ZipEntry.setTime() Bug in > > Jazzlib 0.0.7 ? > > > > The ZipEntry.setTime() method is implemented as follows: > > > > public void setTime(long time) > > { > > Calendar cal = getCalendar(); > > synchronized (cal) > > { > > cal.setTime(new Date(time*1000L)); > > dostime = (cal.get(Calendar.YEAR) - 1980 & 0x7f) << 25 > > | (cal.get(Calendar.MONTH) + 1) << 21 > > | (cal.get(Calendar.DAY_OF_MONTH)) << 16 > > | (cal.get(Calendar.HOUR_OF_DAY)) << 11 > > | (cal.get(Calendar.MINUTE)) << 5 > > | (cal.get(Calendar.SECOND)) >> 1; > > } > > dostime = (int) (dostime / 1000L); > > this.known |= KNOWN_TIME; > > } > > > > Questions: > > -> Why is the 'time' parameter multiplied by 1000 for the > > Date constructor? > > According to the original java.util.zip documentation, the > > parameter is already in milliseconds, as required by the Date() ctor. > > -> Why is the resulting dostime divided by 1000 again at the end? > > > > I did some tests and loaded the resulting ZIP with WinZIP, > > and the WinZIP test resulted in: > > > > Teste ... > > Bei Datei "xxx.txt" ist das Verzeichnisdatum zentral falsch. > > Stattdessen wird das aktuelle Systemdatum verwendet. > > Bei Datei "xxx.txt" ist das Verzeichnisdatum lokal falsch. > > Stattdessen wird das aktuelle Systemdatum verwendet. > > Teste: xxx.txt OK > > Es wurde mindestens ein Warnung --Fehler in xxx.zip entdeckt. > > > > Sorry - it's a german ZIP version. The error messages mean > > roughly translated that the timestamp (central) and the > > timestamp (local) is wrong, and that winzip uses the current > > system time instead. > > > > When I removed the '*1000' in the Date ctor call and the > > dosttime=dostime/1000, all worked perfectly - WinZip did no > > longer issue warnings and displayed the actual date of the > > file that was zipped. > > > > > > ------------------------------------------------------- > > SF.Net email is Sponsored by the Better Software Conference & > > EXPO September 19-22, 2005 * San Francisco, CA * Development > > Lifecycle Practices Agile & Plan-Driven Development * > > Managing Projects & Teams * Testing & QA Security * Process > > Improvement & Measurement * http://www.sqe.com/bsce5sf > > _______________________________________________ > > Jazzlib-developers mailing list > > Jaz...@li... > > https://lists.sourceforge.net/lists/listinfo/jazzlib-developers |