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 2024/01/22 10:46:00 UTC

[jira] [Commented] (PDFBOX-5755) NullPointerException in CmapSubtable

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

Tilman Hausherr commented on PDFBOX-5755:
-----------------------------------------

I answered that one on the users list:

{quote}
I hope I'm not wrong on this, but if the second element is true {{(glyphIdToCharacterCode == null)}} then the third one wouldn't be evaluated, because there's no need. (short circuit evaluation)

Look at PDFBOX-5465, the stack trace looks just like yours.

Could it be you're not really using 2.0.28 but 2.0.26 or earlier? 
{quote}


> NullPointerException in CmapSubtable
> ------------------------------------
>
>                 Key: PDFBOX-5755
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5755
>             Project: PDFBox
>          Issue Type: Bug
>          Components: FontBox
>    Affects Versions: 2.0.28
>            Reporter: Michal Stefan
>            Priority: Minor
>
> Hi,
> there was a NPE in getCharCode method of CmapSubtable:
> {code:java}
> java.lang.NullPointerException: Cannot read the array length because "this.glyphIdToCharacterCode" is null
> 	at org.apache.fontbox.ttf.CmapSubtable.getCharCode(CmapSubtable.java:669)
> 	at org.apache.fontbox.ttf.CmapSubtable.getCharCodes(CmapSubtable.java:686)
> 	at org.apache.pdfbox.pdmodel.font.PDType0Font.toUnicode(PDType0Font.java:533)
> 	at org.apache.pdfbox.contentstream.PDFStreamEngine.showGlyph(PDFStreamEngine.java:838)
> 	at org.apache.pdfbox.contentstream.PDFStreamEngine.showText(PDFStreamEngine.java:776)
> 	at org.apache.pdfbox.contentstream.PDFStreamEngine.showTextStrings(PDFStreamEngine.java:681)
> 	at org.apache.pdfbox.contentstream.operator.text.ShowTextAdjusted.process(ShowTextAdjusted.java:53)
> 	at org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:966)
> 	at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:541)
> 	at org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:516)
> 	at org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:155)
> 	at org.apache.pdfbox.text.LegacyPDFStreamEngine.processPage(LegacyPDFStreamEngine.java:155)
> 	at org.apache.pdfbox.text.PDFTextStripper.processPage(PDFTextStripper.java:363)
> 	at org.apache.pdfbox.text.PDFTextStripper.processPages(PDFTextStripper.java:291)
> 	at org.apache.pdfbox.text.PDFTextStripper.writeText(PDFTextStripper.java:238)
> 	at org.apache.pdfbox.text.PDFTextStripper.getText(PDFTextStripper.java:202){code}
> Unfortunately I cannot provide pdf for privacy reason (and I don't have it anyway), Looking at the code, it suggests that even if the glyphIdToCharacterCode is null, it's still possible that glyphIdToCharacerCode.length gets evaluated
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org