Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8073187

Unexpected side effect in Pack200

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:

      Backports

        Description

        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

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                ksrini Kumar Srinivasan
                Reporter:
                mcherkas Mikhail Cherkasov (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: