Skip to content

Commit 63e8425

Browse files
Close all PDDocument in test
1 parent 9ac1de1 commit 63e8425

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fop-core/src/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ private void checkEncoding(byte[] pdf, String[] testPattern)
166166

167167
private static String extractTextFromPDF(byte[] pdfContent) throws IOException {
168168
PDFTextStripper pdfStripper = new PDFTextStripper();
169-
PDDocument pdDoc = Loader.loadPDF(pdfContent);
170-
return pdfStripper.getText(pdDoc);
169+
try (PDDocument pdDoc = Loader.loadPDF(pdfContent)) {
170+
return pdfStripper.getText(pdDoc);
171+
}
171172
}
172173
}

0 commit comments

Comments
 (0)