You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2025/12/22 13:57:24 UTC

svn commit: r1930800 - pdfbox/branches/2.0/xmpbox/src/test/java/org/apache/xmpbox/xml

Author: tilman
Date: Mon Dec 22 13:57:24 2025
New Revision: 1930800

Log:
PDFBOX-5660: expand test coverage

Modified:
   pdfbox/branches/2.0/xmpbox/src/test/java/org/apache/xmpbox/xml/DomXmpParserTest.java

Modified: pdfbox/branches/2.0/xmpbox/src/test/java/org/apache/xmpbox/xml/DomXmpParserTest.java
==============================================================================
--- pdfbox/branches/2.0/xmpbox/src/test/java/org/apache/xmpbox/xml/DomXmpParserTest.java	Mon Dec 22 13:44:45 2025	(r1930799)
+++ pdfbox/branches/2.0/xmpbox/src/test/java/org/apache/xmpbox/xml/DomXmpParserTest.java	Mon Dec 22 13:57:24 2025	(r1930800)
@@ -1450,6 +1450,28 @@ public class DomXmpParserTest
         {
             assertEquals("Schema is not set in this document : http://www.w3.org/XML/1998/namespace, property: xml:ModifyDate", ex.getMessage());
         }
-        
+    }
+    
+    @Test
+    public void testNoInstantiation() throws XmpParsingException, UnsupportedEncodingException
+    {
+        // Instantiation fails because of bad date
+        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:xmp=\"http://ns.adobe.com/xap/1.0/\" rdf:about=\"uuid:f577a812-a531-11f4-0000-2eba1231b686\">\n" +
+                    "            <xmp:CreateDate>2019-05-02T22:03:5Z</xmp:CreateDate>\n" +
+                    "        </rdf:Description>\n" +
+                    "    </rdf:RDF>\n" +
+                    "</x:xmpmeta><?xpacket end='w'?>";
+        try
+        {
+            new DomXmpParser().parse(s.getBytes("utf-8"));
+            fail("XmpParsingException expected");
+        }
+        catch (XmpParsingException ex)
+        {
+            assertEquals("Failed to instantiate DateType property with value 2019-05-02T22:03:5Z in xmp:CreateDate", ex.getMessage());
+        }
     }
 }