diff -r 285c02ecbb8a -r ee97f78e7482 jdk/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java --- a/jdk/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java Fri Nov 05 17:15:44 2010 +0000 +++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java Fri Nov 05 14:15:25 2010 -0700 @@ -92,7 +92,13 @@ * @param out a JarOutputStream. * @exception IOException if an error is encountered. */ - public void unpack(InputStream in0, JarOutputStream out) throws IOException { + public void unpack(InputStream in, JarOutputStream out) throws IOException { + if (in == null) { + throw new NullPointerException("null input"); + } + if (out == null) { + throw new NullPointerException("null output"); + } assert(Utils.currentInstance.get() == null); TimeZone tz = (props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE)) ? null @@ -102,18 +108,18 @@ Utils.currentInstance.set(this); if (tz != null) TimeZone.setDefault(TimeZone.getTimeZone("UTC")); final int verbose = props.getInteger(Utils.DEBUG_VERBOSE); - BufferedInputStream in = new BufferedInputStream(in0); - if (Utils.isJarMagic(Utils.readMagic(in))) { + BufferedInputStream in0 = new BufferedInputStream(in); + if (Utils.isJarMagic(Utils.readMagic(in0))) { if (verbose > 0) Utils.log.info("Copying unpacked JAR file..."); - Utils.copyJarFile(new JarInputStream(in), out); + Utils.copyJarFile(new JarInputStream(in0), out); } else if (props.getBoolean(Utils.DEBUG_DISABLE_NATIVE)) { - (new DoUnpack()).run(in, out); - in.close(); + (new DoUnpack()).run(in0, out); + in0.close(); Utils.markJarFile(out); } else { - (new NativeUnpack(this)).run(in, out); - in.close(); + (new NativeUnpack(this)).run(in0, out); + in0.close(); Utils.markJarFile(out); } } finally { @@ -132,6 +138,12 @@ * @exception IOException if an error is encountered. */ public void unpack(File in, JarOutputStream out) throws IOException { + if (in == null) { + throw new NullPointerException("null input"); + } + if (out == null) { + throw new NullPointerException("null output"); + } // Use the stream-based implementation. // %%% Reconsider if native unpacker learns to memory-map the file. FileInputStream instr = new FileInputStream(in);