Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-4967

PDImageXObject and XmpParsingException with a create date

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Bug
    • 2.0.0
    • None
    • Parsing, PDModel, XmpBox
    • Windows 10 (64 Bit), Java 11.0.8, Netbeans 11.2

    Description

      The goal is to add Metadata with a create date to an image within the PDF document.

      It doesn't work with Java 11 starting from PDFBox 2.0.0.
      It does work instead with Java 8 starting from PDFBox 2.0.0 till PDFBox 2.0.11.

      // Output
      Sep. 25, 2020 11:59:44 VORM. sample.application.SampleApplication retrieveMetadataOfImage
      SCHWERWIEGEND: null
      org.apache.xmpbox.xml.XmpParsingException: Failed to instanciate DateType property with value 2020-09-25T11:59:44+02:00 in xmp:CreateDate
      	at org.apache.xmpbox.xml.DomXmpParser.createProperty(DomXmpParser.java:361)
      	at org.apache.xmpbox.xml.DomXmpParser.parseChildrenAsProperties(DomXmpParser.java:311)
      	at org.apache.xmpbox.xml.DomXmpParser.parseDescriptionRoot(DomXmpParser.java:240)
      	at org.apache.xmpbox.xml.DomXmpParser.parse(DomXmpParser.java:204)
      	at sample.application.SampleApplication.retrieveMetadataOfImage(SampleApplication.java:107)
      	at sample.application.SampleApplication.main(SampleApplication.java:69)
      Caused by: java.lang.IllegalArgumentException: Failed to instanciate DateType property with value 2020-09-25T11:59:44+02:00
      	at org.apache.xmpbox.type.TypeMapping.instanciateSimpleProperty(TypeMapping.java:204)
      	at org.apache.xmpbox.xml.DomXmpParser.manageSimpleType(DomXmpParser.java:424)
      	at org.apache.xmpbox.xml.DomXmpParser.createProperty(DomXmpParser.java:348)
      	... 5 more
      Caused by: java.lang.reflect.InvocationTargetException
      	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
      	at org.apache.xmpbox.type.TypeMapping.instanciateSimpleProperty(TypeMapping.java:184)
      	... 7 more
      Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
      	at org.apache.xmpbox.DateConverter.fromISO8601(DateConverter.java:403)
      	at org.apache.xmpbox.DateConverter.toCalendar(DateConverter.java:102)
      	at org.apache.xmpbox.type.DateType.isGoodType(DateType.java:98)
      	at org.apache.xmpbox.type.DateType.setValue(DateType.java:118)
      	at org.apache.xmpbox.type.AbstractSimpleProperty.<init>(AbstractSimpleProperty.java:59)
      	at org.apache.xmpbox.type.DateType.<init>(DateType.java:57)
      	... 12 more
      Caused by: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter
      	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
      	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
      	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
      	... 18 more
      

      Attachments

        1. SampleApplication.java
          4 kB
          Robert Fink

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Robertoni Robert Fink
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: