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

DomXmpParser fails to parse date

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.2, 2.0.3, 3.0.0 PDFBox
    • 2.0.3, 3.0.0 PDFBox
    • XmpBox
    • None

    Description

      XMP specifies YYYY-MM-DDThh:mmTZD as valid date format, but the parser fails to parse 2011-11-20T10:09Z with the following exception:

      org.apache.xmpbox.xml.XmpParsingException: Failed to instanciate property in xap: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 org.apache.xmpbox.xml.DomXmpParser.parse(DomXmpParser.java:111)
      at pmedit.TestDcDates.testDateFormat(TestDcDates.java:110)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
      at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
      at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
      at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
      at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
      at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
      at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
      Caused by: java.lang.IllegalArgumentException: Failed to instanciate property
      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)
      ... 34 more
      Caused by: java.lang.reflect.InvocationTargetException
      at sun.reflect.GeneratedConstructorAccessor5.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      at org.apache.xmpbox.type.TypeMapping.instanciateSimpleProperty(TypeMapping.java:184)
      ... 36 more
      Caused by: java.lang.IllegalArgumentException: 2011-11-20T10:09
      at com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl$Parser.read(XMLGregorianCalendarImpl.java:2837)
      at com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl$Parser.skip(XMLGregorianCalendarImpl.java:2843)
      at com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl$Parser.parse(XMLGregorianCalendarImpl.java:2766)
      at com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl.<init>(XMLGregorianCalendarImpl.java:435)
      at com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl.newXMLGregorianCalendar(DatatypeFactoryImpl.java:536)
      at javax.xml.bind.DatatypeConverterImpl._parseDateTime(DatatypeConverterImpl.java:422)
      at javax.xml.bind.DatatypeConverterImpl.parseDateTime(DatatypeConverterImpl.java:417)
      at javax.xml.bind.DatatypeConverter.parseDateTime(DatatypeConverter.java:327)
      at org.apache.xmpbox.DateConverter.fromISO8601(DateConverter.java:369)
      at org.apache.xmpbox.DateConverter.toCalendar(DateConverter.java:101)
      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)
      ... 40 more

      Attachments

        1. TestParseDate.java
          3 kB
          Svetlozar Argirov

        Issue Links

          Activity

            People

              tilman Tilman Hausherr
              zaro Svetlozar Argirov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: