src/share/classes/com/sun/java/util/jar/pack/PackerImpl.java

Print this page

        

*** 77,107 **** /** * Takes a JarFile and converts into a pack-stream. * <p> * Closes its input but not its output. (Pack200 archives are appendable.) * @param in a JarFile * @param out an OutputStream * @exception IOException if an error is encountered. */ public synchronized void pack(JarFile in, OutputStream out) throws IOException { ! assert(Utils.currentInstance.get() == null); ! TimeZone tz = (props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE)) ! ? null ! : TimeZone.getDefault(); try { Utils.currentInstance.set(this); ! if (tz != null) TimeZone.setDefault(TimeZone.getTimeZone("UTC")); if ("0".equals(props.getProperty(Pack200.Packer.EFFORT))) { Utils.copyJarFile(in, out); } else { (new DoPack()).run(in, out); } } finally { Utils.currentInstance.set(null); ! if (tz != null) TimeZone.setDefault(tz); in.close(); } } /** --- 77,111 ---- /** * Takes a JarFile and converts into a pack-stream. * <p> * Closes its input but not its output. (Pack200 archives are appendable.) + * * @param in a JarFile * @param out an OutputStream * @exception IOException if an error is encountered. */ public synchronized void pack(JarFile in, OutputStream out) throws IOException { ! assert (Utils.currentInstance.get() == null); ! ! boolean needUTC = !props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE); try { Utils.currentInstance.set(this); ! if (needUTC) { ! Utils.changeDefaultTimeZoneToUtc(); ! } if ("0".equals(props.getProperty(Pack200.Packer.EFFORT))) { Utils.copyJarFile(in, out); } else { (new DoPack()).run(in, out); } } finally { Utils.currentInstance.set(null); ! if (needUTC) { ! Utils.restoreDefaultTimeZone(); ! } in.close(); } } /**
*** 117,143 **** * @param in a JarInputStream * @param out an OutputStream * @exception IOException if an error is encountered. */ public synchronized void pack(JarInputStream in, OutputStream out) throws IOException { ! assert(Utils.currentInstance.get() == null); ! TimeZone tz = (props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE)) ? null : ! TimeZone.getDefault(); try { Utils.currentInstance.set(this); ! if (tz != null) TimeZone.setDefault(TimeZone.getTimeZone("UTC")); if ("0".equals(props.getProperty(Pack200.Packer.EFFORT))) { Utils.copyJarFile(in, out); } else { (new DoPack()).run(in, out); } } finally { Utils.currentInstance.set(null); ! if (tz != null) TimeZone.setDefault(tz); in.close(); } } /** * Register a listener for changes to options. * @param listener An object to be invoked when a property is changed. */ public void addPropertyChangeListener(PropertyChangeListener listener) { --- 121,151 ---- * @param in a JarInputStream * @param out an OutputStream * @exception IOException if an error is encountered. */ public synchronized void pack(JarInputStream in, OutputStream out) throws IOException { ! assert (Utils.currentInstance.get() == null); ! boolean needUTC = !props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE); try { Utils.currentInstance.set(this); ! if (needUTC) { ! Utils.changeDefaultTimeZoneToUtc(); ! } if ("0".equals(props.getProperty(Pack200.Packer.EFFORT))) { Utils.copyJarFile(in, out); } else { (new DoPack()).run(in, out); } } finally { Utils.currentInstance.set(null); ! if (needUTC) { ! Utils.restoreDefaultTimeZone(); ! } in.close(); } } + /** * Register a listener for changes to options. * @param listener An object to be invoked when a property is changed. */ public void addPropertyChangeListener(PropertyChangeListener listener) {