RFR: Let jar tool print timestamps in default locale date and time in format

Jacob Wisor gitne at gmx.de
Fri Mar 6 14:49:47 UTC 2015


Hello there!

I have stumbled upon the jar tool always printing nominally the same date and 
time for a JarEntry, regardless of the timezone set. Confused by this, I dug 
into the code only to find out that the zip file format does neither store 
timezone information nor timestamps in UTC. This basically means that timestamps 
in jar/zip files are or can be assumed to always be in the local timezone, hence 
there is no conceivable fix for this problem, except for altering the zip file 
format specification. However, timestamps are printed in the en_US locale 
currently. This locale is /almost/ as arbitrary as every other. So, this patch 
makes the jar tool print timestamps in the default locale date and time format.

If anybody is bothered by this change they can still explicitly set the 
user.language property or the system's locale to en_US.
If anybody /really/ wants to parse jar tool's timestamps output they should 
probably be relying on ISO formatted timestamps. I can add this functionality as 
a flag.

Anyways, please review this patch.

Regards,

Jacob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Print JAR file entry timestamps in default locale date and time format.patch
Type: text/x-patch
Size: 1059 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/jdk7u-dev/attachments/20150306/0c2cedad/PrintJARfileentrytimestampsindefaultlocaledateandtimeformat.patch>


More information about the jdk7u-dev mailing list