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/16 19:25:30 UTC
svn commit: r1930642 - pdfbox/branches/2.0/xmpbox/src/test/java/org/apache/xmpbox/xml
Author: tilman
Date: Tue Dec 16 19:25:29 2025
New Revision: 1930642
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 Tue Dec 16 18:45:02 2025 (r1930641)
+++ pdfbox/branches/2.0/xmpbox/src/test/java/org/apache/xmpbox/xml/DomXmpParserTest.java Tue Dec 16 19:25:29 2025 (r1930642)
@@ -626,6 +626,35 @@ public class DomXmpParserTest
}
@Test
+ public void testBadType2() throws XmpParsingException, BadFieldValueException, UnsupportedEncodingException
+ {
+ String s = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" +
+ "<?xpacket begin=\"\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>\n" +
+ "<x:xmpmeta xmlns:x=\"adobe:ns:meta/\"\n" +
+ " x:xmptk=\"3.1.1-111\">\n" +
+ " <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n" +
+ " <rdf:Description xmlns:pdf=\"http://ns.adobe.com/pdf/1.3/\"\n" +
+ " rdf:about=\"\">\n" +
+ " <pdf:Bad>Value</pdf:Bad>\n" +
+ " </rdf:Description>\n" +
+ " </rdf:RDF>\n" +
+ "</x:xmpmeta><?xpacket end=\"r\"?>";
+ try
+ {
+ new DomXmpParser().parse(s.getBytes("utf-8"));
+ fail("XmpParsingException expected");
+ }
+ catch (XmpParsingException ex)
+ {
+ assertEquals("No type defined for {http://ns.adobe.com/pdf/1.3/}Bad", ex.getMessage());
+ }
+ final DomXmpParser xmpParser2 = new DomXmpParser();
+ xmpParser2.setStrictParsing(false);
+ XMPMetadata xmp = xmpParser2.parse(s.getBytes("utf-8"));
+ assertEquals("Value", xmp.getAdobePDFSchema().getUnqualifiedTextPropertyValue("Bad"));
+ }
+
+ @Test
public void testBadLocalName() throws XmpParsingException, UnsupportedEncodingException
{
String s = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" +