You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by ss...@apache.org on 2025/10/02 09:14:08 UTC

(xmlgraphics-fop) branch main updated: Close all PDDocument in test

This is an automated email from the ASF dual-hosted git repository.

ssteiner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/xmlgraphics-fop.git


The following commit(s) were added to refs/heads/main by this push:
     new 63e8425c7 Close all PDDocument in test
63e8425c7 is described below

commit 63e8425c791eeb01b04de63fa4e2f9547fbd0f8b
Author: Simon Steiner <ss...@apache.org>
AuthorDate: Thu Oct 2 10:13:32 2025 +0100

    Close all PDDocument in test
---
 .../src/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fop-core/src/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java b/fop-core/src/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java
index 02e4e702b..9659157e8 100644
--- a/fop-core/src/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java
+++ b/fop-core/src/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java
@@ -166,7 +166,8 @@ public class PDFEncodingTestCase extends BasePDFTest {
 
     private static String extractTextFromPDF(byte[] pdfContent) throws IOException {
         PDFTextStripper pdfStripper = new PDFTextStripper();
-        PDDocument pdDoc = Loader.loadPDF(pdfContent);
-        return pdfStripper.getText(pdDoc);
+        try (PDDocument pdDoc = Loader.loadPDF(pdfContent)) {
+            return pdfStripper.getText(pdDoc);
+        }
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org