You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (Jira)" <ji...@apache.org> on 2021/02/10 16:18:00 UTC
[jira] [Closed] (PDFBOX-5099) PDDocumentInformation
java.lang.StringIndexOutOfBoundsException: String index out of range: 2
[ https://issues.apache.org/jira/browse/PDFBOX-5099?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tilman Hausherr closed PDFBOX-5099.
-----------------------------------
Resolution: Duplicate
Duplicate of PDFBOX-5046. This was fixed last year. Please update to 2.0.22.
> PDDocumentInformation java.lang.StringIndexOutOfBoundsException: String index out of range: 2
> ---------------------------------------------------------------------------------------------
>
> Key: PDFBOX-5099
> URL: https://issues.apache.org/jira/browse/PDFBOX-5099
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 2.0.21
> Environment: PDFBox 2.0.21 Java
> Reporter: Stefan Geelen
> Priority: Minor
>
> I have a PDF without CreateDate
> Following
> {quote}PDDocumentInformation docinfo = pdDoc.getDocumentInformation();
> docinfo.getCreationDate();
> {quote}
> throws
> {quote}java.lang.StringIndexOutOfBoundsException: String index out of range: 2java.lang.StringIndexOutOfBoundsException: String index out of range: 2 at java.lang.String.charAt(String.java:658) at org.apache.pdfbox.util.DateConverter.parseDate(DateConverter.java:656) at org.apache.pdfbox.util.DateConverter.toCalendar(DateConverter.java:724) at org.apache.pdfbox.util.DateConverter.toCalendar(DateConverter.java:702) at org.apache.pdfbox.cos.COSDictionary.getDate(COSDictionary.java:861) at org.apache.pdfbox.pdmodel.PDDocumentInformation.getCreationDate(PDDocumentInformation.java:212)
> {quote}
> Better should be to return null in case no createdate exists (same with getModificationDate I assume - not tested).
> Currently there is no other way tha putting this in a try catch to omit this error.
> a
> {quote}docinfo.hasCreationDate();
> {quote}
> would also be handy (same for other properties).
> Looking inside the PDF structure this is the Info:
> {quote}7 0 obj
> <<
> /CreationDate (D: )
> /Creator (Samsung Electronics)
> /Producer (CloudConvert)
> /ModDate (D:20210209103114Z)
> /Keywords (urn:uuid:313707-D7BA577B-6584-AC90-7235-4BDFD4C6CCB8)
> {quote}
>
> I guess it is an illegal Date value .
>
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org