diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-04-22 22:14:43 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-04-22 22:14:43 +0100 |
| commit | 43457f3575072f543060273d5a83b375222c43d3 (patch) | |
| tree | 63f6daab5c90ce60ff4ebaa529a3b477d721f9cf /src/main/java/org | |
| parent | 8a9ad774dd4ae6812c509e6c0febfaa1cd2edef4 (diff) | |
Use try-with-resources again
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(); } } |
