aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-04-22 22:14:43 +0100
committerMichael Williamson <mike@zwobble.org>2016-04-22 22:14:43 +0100
commit43457f3575072f543060273d5a83b375222c43d3 (patch)
tree63f6daab5c90ce60ff4ebaa529a3b477d721f9cf /src
parent8a9ad774dd4ae6812c509e6c0febfaa1cd2edef4 (diff)
Use try-with-resources again
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/zwobble/mammoth/internal/InternalDocumentConverter.java10
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();
}
}