Author: tilman
Date: Wed Dec 31 14:08:24 2025
New Revision: 1931005
Log:
PDFBOX-5660: expand test coverage
Modified:
pdfbox/branches/3.0/xmpbox/src/test/java/org/apache/xmpbox/xml/DomXmpParserTest.java
Modified:
pdfbox/branches/3.0/xmpbox/src/test/java/org/apache/xmpbox/xml/DomXmpParserTest.java
==============================================================================
---
pdfbox/branches/3.0/xmpbox/src/test/java/org/apache/xmpbox/xml/DomXmpParserTest.java
Wed Dec 31 14:08:20 2025 (r1931004)
+++
pdfbox/branches/3.0/xmpbox/src/test/java/org/apache/xmpbox/xml/DomXmpParserTest.java
Wed Dec 31 14:08:24 2025 (r1931005)
@@ -1419,7 +1419,7 @@ class DomXmpParserTest
@Test
void testNoInstantiation() throws XmpParsingException
{
- // Instantiation fails because of bad date
+ // Instantiation fails because of a bad date property
String s = "<?xml version=\"1.0\" encoding=\"UTF-8\"
standalone=\"no\"?>\n" +
"<?xpacket begin=''
id='W5M0MpCehiHzreSzNTczkc9d'?><?adobe-xap-filters esc=\"CRLF\"?><x:xmpmeta
xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"XMP toolkit 2.9.1-13, framework 1.6\">\n" +
" <rdf:RDF xmlns:iX=\"http://ns.adobe.com/iX/1.0/\"
xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n" +
@@ -1435,6 +1435,25 @@ class DomXmpParserTest
}
@Test
+ void testNoInstantiation2() throws XmpParsingException
+ {
+ // Instantiation fails because of a bad date attribute
+ String s =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"
standalone=\"no\"?>\n" +
+ "<?xpacket begin=''
id='W5M0MpCehiHzreSzNTczkc9d'?><?adobe-xap-filters esc=\"CRLF\"?><x:xmpmeta
xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"XMP toolkit 2.9.1-13, framework 1.6\">\n" +
+ " <rdf:RDF xmlns:iX=\"http://ns.adobe.com/iX/1.0/\"
xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n" +
+ " <rdf:Description
xmlns:xap=\"http://ns.adobe.com/xap/1.0/\"
xap:CreateDate=\"2016-03-09T19:47:1Z\">\n" +
+ " <xap:CreatorTool>PrimoPDF
http://www.primopdf.com</xap:CreatorTool>\n" +
+ " </rdf:Description>\n" +
+ " </rdf:RDF>\n" +
+ "</x:xmpmeta><?xpacket end='w'?>";
+ final DomXmpParser xmpParser1 = new DomXmpParser();
+ XmpParsingException ex = assertThrows(XmpParsingException.class,
+ () -> xmpParser1.parse(s.getBytes(StandardCharsets.UTF_8)));
+ assertEquals("Failed to instantiate DateType property with value
2016-03-09T19:47:1Z in xap:CreateDate", ex.getMessage());
+ }
+
+ @Test
void testPDFBox6131() throws IOException, XmpParsingException,
BadFieldValueException
{
// Contains "Open Choice of Integer" instead of "open Choice of
Integer"