Skip to content

Commit 2e6fe11

Browse files
committed
PDFBOX-5660: expand test coverage
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1930802 13f79535-47bb-0310-9956-ffa450edef68
1 parent f34e088 commit 2e6fe11

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

xmpbox/src/test/java/org/apache/xmpbox/xml/DomXmpParserTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,4 +1373,22 @@ void testNoSchema() throws XmpParsingException
13731373
() -> xmpParser1.parse(s.getBytes(StandardCharsets.UTF_8)));
13741374
assertEquals("Schema is not set in this document : http://www.w3.org/XML/1998/namespace, property: xml:ModifyDate", ex.getMessage());
13751375
}
1376+
1377+
@Test
1378+
void testNoInstantiation() throws XmpParsingException
1379+
{
1380+
// Instantiation fails because of bad date
1381+
String s = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" +
1382+
"<?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" +
1383+
" <rdf:RDF xmlns:iX=\"http://ns.adobe.com/iX/1.0/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n" +
1384+
" <rdf:Description xmlns:xmp=\"http://ns.adobe.com/xap/1.0/\" rdf:about=\"uuid:f577a812-a531-11f4-0000-2eba1231b686\">\n" +
1385+
" <xmp:CreateDate>2019-05-02T22:03:5Z</xmp:CreateDate>\n" +
1386+
" </rdf:Description>\n" +
1387+
" </rdf:RDF>\n" +
1388+
"</x:xmpmeta><?xpacket end='w'?>";
1389+
final DomXmpParser xmpParser1 = new DomXmpParser();
1390+
XmpParsingException ex = assertThrows(XmpParsingException.class,
1391+
() -> xmpParser1.parse(s.getBytes(StandardCharsets.UTF_8)));
1392+
assertEquals("Failed to instantiate DateType property with value 2019-05-02T22:03:5Z in xmp:CreateDate", ex.getMessage());
1393+
}
13761394
}

0 commit comments

Comments
 (0)