diff options
Diffstat (limited to 'src/main/java/org')
| -rw-r--r-- | src/main/java/org/zwobble/mammoth/internal/InternalDocumentConverter.java | 10 |
1 files changed, 2 insertions, 8 deletions
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> T withDocxFile(File file, Function<DocxFile, T> 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> T withDocxFile(InputStream stream, Function<DocxFile, T> function) throws IOException { - DocxFile zipFile = InMemoryDocxFile.fromStream(stream); - try { + try (DocxFile zipFile = InMemoryDocxFile.fromStream(stream)) { return function.apply(zipFile); - } finally { - zipFile.close(); } } |
