Merge pull request #600 from Malte-Neu/fixResourceHandle
Fixes a problem where a stream was not safely closed
This commit is contained in:
@@ -83,9 +83,10 @@ public class ZUGFeRDExporterFromPDFA implements IZUGFeRDExporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected byte[] filenameToByteArray(String pdfFilename) throws IOException {
|
protected byte[] filenameToByteArray(String pdfFilename) throws IOException {
|
||||||
FileInputStream fileInputStream = new FileInputStream(pdfFilename);
|
try (FileInputStream fileInputStream = new FileInputStream(pdfFilename)) {
|
||||||
return inputstreamToByteArray(fileInputStream);
|
return inputstreamToByteArray(fileInputStream);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected byte[] inputstreamToByteArray(InputStream fileInputStream) throws IOException {
|
protected byte[] inputstreamToByteArray(InputStream fileInputStream) throws IOException {
|
||||||
byte[] bytes = new byte[fileInputStream.available()];
|
byte[] bytes = new byte[fileInputStream.available()];
|
||||||
|
|||||||
Reference in New Issue
Block a user