diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporterFromPDFA.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporterFromPDFA.java index 498ae7dc..c3b9299b 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporterFromPDFA.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporterFromPDFA.java @@ -83,8 +83,9 @@ public IZUGFeRDExporter getExporter() { } protected byte[] filenameToByteArray(String pdfFilename) throws IOException { - FileInputStream fileInputStream = new FileInputStream(pdfFilename); - return inputstreamToByteArray(fileInputStream); + try (FileInputStream fileInputStream = new FileInputStream(pdfFilename)) { + return inputstreamToByteArray(fileInputStream); + } } protected byte[] inputstreamToByteArray(InputStream fileInputStream) throws IOException {