You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Philip Helger (JIRA)" <ji...@apache.org> on 2011/06/27 14:26:47 UTC

[jira] [Commented] (PDFBOX-823) NullPointerException in DateConverter.toISO8601(DateConverter.java:221)

    [ https://issues.apache.org/jira/browse/PDFBOX-823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13055495#comment-13055495 ] 

Philip Helger commented on PDFBOX-823:
--------------------------------------

I think this issue can be closed for 1.5.0

> NullPointerException in DateConverter.toISO8601(DateConverter.java:221)
> -----------------------------------------------------------------------
>
>                 Key: PDFBOX-823
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-823
>             Project: PDFBox
>          Issue Type: Bug
>          Components: JempBox
>    Affects Versions: 1.2.1
>         Environment: JDK 1.6.0_21, Windows XP 32 Bit
>            Reporter: MH
>
> 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

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira