From 43457f3575072f543060273d5a83b375222c43d3 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Fri, 22 Apr 2016 22:14:43 +0100 Subject: Use try-with-resources again --- .../zwobble/mammoth/internal/InternalDocumentConverter.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/main/java/org') diff --git a/src/main/java/org/zwobble/mammoth/internal/InternalDocumentConverter.java b/src/main/java/org/zwobble/mammoth/internal/InternalDocumentConverter.java index 4cc0e28..0e829ea 100644 --- a/src/main/java/org/zwobble/mammoth/internal/InternalDocumentConverter.java +++ b/src/main/java/org/zwobble/mammoth/internal/InternalDocumentConverter.java @@ -71,20 +71,14 @@ public class InternalDocumentConverter { } private static T withDocxFile(File file, Function function) throws IOException { - DocxFile zipFile = new ZippedDocxFile(file); - try { + try (DocxFile zipFile = new ZippedDocxFile(file)) { return function.apply(zipFile); - } finally { - zipFile.close(); } } private static T withDocxFile(InputStream stream, Function function) throws IOException { - DocxFile zipFile = InMemoryDocxFile.fromStream(stream); - try { + try (DocxFile zipFile = InMemoryDocxFile.fromStream(stream)) { return function.apply(zipFile); - } finally { - zipFile.close(); } } -- cgit v1.2.3