Skip to content

Commit

Permalink
Merge pull request #600 from Malte-Neu/fixResourceHandle
Browse files Browse the repository at this point in the history
Fixes a problem where a stream was not safely closed
  • Loading branch information
jstaerk authored Dec 19, 2024
2 parents 96c3ef7 + 4fce6aa commit 20ece72
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 20ece72

Please sign in to comment.