--- old/src/share/classes/com/sun/java/util/jar/pack/Utils.java 2015-05-20 16:55:44.114765900 +0400 +++ new/src/share/classes/com/sun/java/util/jar/pack/Utils.java 2015-05-20 16:55:43.408725500 +0400 @@ -34,6 +34,7 @@ import java.io.OutputStream; import java.util.Collections; import java.util.Date; +import java.util.TimeZone; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.jar.JarInputStream; @@ -133,6 +134,9 @@ // to the engine code, especially the native code. static final ThreadLocal currentInstance = new ThreadLocal<>(); + private static TimeZone tz; + private static int workingPackerCount = 0; + // convenience method to access the TL globals static TLGlobals getTLGlobals() { return currentInstance.get(); @@ -203,6 +207,24 @@ } } + static synchronized void changeDefaultTimeZoneToUtc() { + if (workingPackerCount++ == 0) { + // only first thread saves default TZ + tz = TimeZone.getDefault(); + TimeZone.setDefault(TimeZone.getTimeZone("UTC")); + } + } + + static synchronized void restoreDefaultTimeZone() { + if (--workingPackerCount == 0) { + // reset timezone when all the packer/unpacker instances have terminated + if (tz != null) { + TimeZone.setDefault(tz); + } + tz = null; + } + } + static final Pack200Logger log = new Pack200Logger("java.util.jar.Pack200");