Author: tilman
Date: Sun Nov 30 16:22:52 2025
New Revision: 1930142

Log:
PDFBOX-5660: improve exception message, refactor

Modified:
   pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/xml/DomXmpParser.java

Modified: 
pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/xml/DomXmpParser.java
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/xml/DomXmpParser.java   
Sun Nov 30 16:22:48 2025        (r1930141)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/xml/DomXmpParser.java   
Sun Nov 30 16:22:52 2025        (r1930142)
@@ -627,11 +627,13 @@ public class DomXmpParser
         // Instantiate abstract structured type with hint from first element
         Element firstLiDescriptionElementChild = 
liDescriptionElementChildren.get(0);
         nsFinder.push(firstLiDescriptionElementChild);
-        PropertyType ctype = checkPropertyDefinition(xmp, 
DomHelper.getQName(firstLiDescriptionElementChild));
+        QName qName = DomHelper.getQName(firstLiDescriptionElementChild);
+        PropertyType ctype = checkPropertyDefinition(xmp, qName);
         if (ctype == null)
         {
-            throw new XmpParsingException(ErrorType.NoType, "ctype is null, 
first: " + firstLiDescriptionElementChild + 
-                    ", DomHelper.getQName(first): " + 
DomHelper.getQName(firstLiDescriptionElementChild));
+            // PDFBOX-5649
+            throw new XmpParsingException(ErrorType.NoType,
+                    "Property '" + qName.getLocalPart() + "' not defined in " 
+ qName.getNamespaceURI());
         }
         Types tt = ctype.type();
         AbstractStructuredType ast = instanciateStructured(tm, tt, 
descriptor.getLocalPart(), firstLiDescriptionElementChild.getNamespaceURI());

Reply via email to