From 77dd3fcc4d85088b15ab859c4438521d9cd6ed10 Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Wed, 15 Apr 2026 13:49:22 +0200 Subject: pdf-as-5 (#82) - JDK 17 - PDFBox 3 - PDF-AS Web moved to Spring Boot - MOA Integration tests w/ new error code --------- Co-authored-by: Gerald Palfinger Co-authored-by: kathrin.resek --- .../java/at/gv/egiz/param_tests/PDFASignatureTest.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'pdf-as-tests/src/test/java/at/gv/egiz/param_tests/PDFASignatureTest.java') diff --git a/pdf-as-tests/src/test/java/at/gv/egiz/param_tests/PDFASignatureTest.java b/pdf-as-tests/src/test/java/at/gv/egiz/param_tests/PDFASignatureTest.java index 4c3e754b..e661bbc2 100644 --- a/pdf-as-tests/src/test/java/at/gv/egiz/param_tests/PDFASignatureTest.java +++ b/pdf-as-tests/src/test/java/at/gv/egiz/param_tests/PDFASignatureTest.java @@ -12,6 +12,7 @@ import java.util.Collection; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; +import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.preflight.PreflightDocument; import org.apache.pdfbox.preflight.ValidationResult; import org.apache.pdfbox.preflight.exception.SyntaxValidationException; @@ -134,15 +135,12 @@ public class PDFASignatureTest extends SignatureTest { * null) */ private Pair checkPDFAConformance(File fd) { - PreflightDocument document = null; ValidationResult result = null; try { PreflightParser parser = new PreflightParser(fd); - parser.parse(); - document = parser.getPreflightDocument(); - document.validate(); - document.close(); - result = document.getResult(); + try (PreflightDocument document = (PreflightDocument) parser.parse()){ + result = document.validate(); + } return new ImmutablePair(result, null); } catch (SyntaxValidationException e) { logger.debug("The file " + fd.getName() @@ -158,10 +156,6 @@ public class PDFASignatureTest extends SignatureTest { + ") occurred, while validating the PDF-A conformance of " + fd.getName(), e); return new ImmutablePair(result, e); - } finally { - if (document != null) { - IOUtils.closeQuietly((Closeable)document); - } } } -- cgit v1.2.3