-
Bug
-
Resolution: Fixed
-
P3
-
None
-
b85
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8142122 | emb-9 | Kumar Srinivasan | P3 | Resolved | Fixed | team |
Pack/unpack method changes default time zone and this isn't documented( at least I didn't find this):
87 public synchronized void pack(JarFile in, OutputStream out) throws IOException {
88 assert(Utils.currentInstance.get() == null);
89 TimeZone tz = (props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE))
90 ? null
91 : TimeZone.getDefault();
92 try {
93 Utils.currentInstance.set(this);
94 if (tz != null) TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
95
96 if ("0".equals(props.getProperty(Pack200.Packer.EFFORT))) {
97 Utils.copyJarFile(in, out);
98 } else {
99 (new DoPack()).run(in, out);
100 }
101 } finally {
102 Utils.currentInstance.set(null);
103 if (tz != null) TimeZone.setDefault(tz);
104 in.close();
105 }
106 }
http://ipw83120.uk.oracle.com:8080/source/xref/jdk7u-cpu/jdk/src/share/classes/com/sun/java/util/jar/pack/PackerImpl.java#87
If we call this code concurrently, the original default time zone can be lost and set to UTC.
we've already faced with this issue in deploy code:
https://bugs.openjdk.java.net/browse/JDK-8066985
87 public synchronized void pack(JarFile in, OutputStream out) throws IOException {
88 assert(Utils.currentInstance.get() == null);
89 TimeZone tz = (props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE))
90 ? null
91 : TimeZone.getDefault();
92 try {
93 Utils.currentInstance.set(this);
94 if (tz != null) TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
95
96 if ("0".equals(props.getProperty(Pack200.Packer.EFFORT))) {
97 Utils.copyJarFile(in, out);
98 } else {
99 (new DoPack()).run(in, out);
100 }
101 } finally {
102 Utils.currentInstance.set(null);
103 if (tz != null) TimeZone.setDefault(tz);
104 in.close();
105 }
106 }
http://ipw83120.uk.oracle.com:8080/source/xref/jdk7u-cpu/jdk/src/share/classes/com/sun/java/util/jar/pack/PackerImpl.java#87
If we call this code concurrently, the original default time zone can be lost and set to UTC.
we've already faced with this issue in deploy code:
https://bugs.openjdk.java.net/browse/JDK-8066985
- backported by
-
JDK-8142122 Unexpected side effect in Pack200
-
- Resolved
-
- duplicates
-
JDK-6791805 Pack200 unpacker implementation can set timezone to utc
-
- Closed
-
- is blocked by
-
JDK-8075526 Need a way to read and write ZipEntry timestamp using local date/time without tz conversion
-
- Closed
-
- relates to
-
JDK-8080438 Lack of synchronization in coding.cpp:init()
-
- Open
-
-
JDK-8066985 Java Webstart downloading packed files can result in Timezone set to UTC
-
- Resolved
-