Try Catch while parsing XMP-Metadata

This commit is contained in:
Jochen Bohn
2025-12-15 09:16:59 +01:00
parent d2948c63ac
commit 9db9689095
3 changed files with 18 additions and 1 deletions

View File

@@ -169,6 +169,16 @@ public class PDFValidatorTest extends ResourceCase {
assertEquals(false, actual.contains("<error"));// issue 18: "ConformanceLevel not found" should not be
// reported since it's actually there
contents = getResourceAsByteArray("invalidXMP-ParseError.pdf");
pv.setFilenameAndContents("invalidXMP-ParseError.pdf", contents);
vc.clear();
pv.validate();
actual = pv.getXMLResult();
assertEquals(true, actual
.contains("<error type=\"10\">XMP Metadata: Could not parse XMP metadata</error>"));
} catch (final IrrecoverableValidationError e) {
// ignore, will be in XML output anyway
}

Binary file not shown.