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

NullPointerException in DateConverter.toISO8601(DateConverter.java:221)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2.1
    • 1.8.3, 2.0.0
    • JempBox
    • None
    • JDK 1.6.0_21, Windows XP 32 Bit

    Description

      I tried to add metadata as shown in AddMetadataFromDocInfo.java. There's also the line

      basicSchema.setModifyDate( info.getModificationDate() );

      but I get a NullPointerException at this line:

      java.lang.NullPointerException
      at org.apache.jempbox.impl.DateConverter.toISO8601(DateConverter.java:221)
      at org.apache.jempbox.xmp.XMPSchema.setDateProperty(XMPSchema.java:249)
      at org.apache.jempbox.xmp.XMPSchemaBasic.setModifyDate(XMPSchemaBasic.java:266)

      because the info.getModificationDate() returns null. It would be better to catch null parameters in the metadata set methods.

      Workaround:

      if (pddi.getModificationDate() != null)

      { basicSchema.setModifyDate(pddi.getModificationDate()); }

      //else: avoid NPE

      Attachments

        Activity

          People

            lehmi Andreas Lehmkühler
            mhilpert MH
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: