src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java
Print this page
rev 3516 : 7021582: convert jar/zip code and tests to use try-with-resources
Reviewed-by: XXX
@@ -159,12 +159,13 @@
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);
+ try (FileInputStream instr = new FileInputStream(in)) {
unpack(instr, out);
+ }
if (props.getBoolean(Utils.UNPACK_REMOVE_PACKFILE)) {
in.delete();
}
}