[ https://issues.apache.org/jira/browse/PDFBOX-5587?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17712415#comment-17712415 ]
Lonzak commented on PDFBOX-5587: -------------------------------- I identified several documents where it (according to the log) did happen. I tried it again and it didn't. I tried several documents but somehow we only got the error for two weeks and now it is gone. That is really strange. Could this be a concurrency issue? E.g. I found the following comment on the getGlyph() method: {code:java} // PDFBOX-4219: synchronize on data because it is accessed by several threads // when PDFBox is accessing a standard 14 font for the first time {code} I thus tried the image conversion using several threads but couldn't reproduce it. Out of curiosity: Is the code related to the system fonts or to the (missing/invalid) font definition inside the PDF? > NullPointerException in PDTrueTypeFont.java getPath( ) > ------------------------------------------------------ > > Key: PDFBOX-5587 > URL: https://issues.apache.org/jira/browse/PDFBOX-5587 > Project: PDFBox > Issue Type: Bug > Components: Parsing > Affects Versions: 2.0.25 > Environment: Linux server > Reporter: Lonzak > Assignee: Tilman Hausherr > Priority: Major > Fix For: 2.0.29, 3.0.0 PDFBox > > > Since April we get the following NPE in our software. > PDFBox is used to convert PDFs to images. > > {code:java} > java.lang.NullPointerException: null > at > org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.getPath(PDTrueTypeFont.java:470) > ~[pdfbox-2.0.25.jar:2.0.25] > at > org.apache.pdfbox.rendering.TTFGlyph2D.getPathForGID(TTFGlyph2D.java:144) > ~[pdfbox-2.0.25.jar:2.0.25] > at > org.apache.pdfbox.rendering.TTFGlyph2D.getPathForCharacterCode(TTFGlyph2D.java:93) > ~[pdfbox-2.0.25.jar:2.0.25] > at > org.apache.pdfbox.rendering.PageDrawer.drawGlyph2D(PageDrawer.java:514) > ~[pdfbox-2.0.25.jar:2.0.25] > at > org.apache.pdfbox.rendering.PageDrawer.showFontGlyph(PageDrawer.java:495) > ~[pdfbox-2.0.25.jar:2.0.25] > at > org.apache.pdfbox.contentstream.PDFStreamEngine.showGlyph(PDFStreamEngine.java:793) > ~[pdfbox-2.0.25.jar:2.0.25] > at > org.apache.pdfbox.contentstream.PDFStreamEngine.showGlyph(PDFStreamEngine.java:811) > ~[pdfbox-2.0.25.jar:2.0.25] > at > org.apache.pdfbox.contentstream.PDFStreamEngine.showText(PDFStreamEngine.java:749) > ~[pdfbox-2.0.25.jar:2.0.25] > at > org.apache.pdfbox.contentstream.PDFStreamEngine.showTextString(PDFStreamEngine.java:608) > ~[pdfbox-2.0.25.jar:2.0.25] > at > org.apache.pdfbox.contentstream.operator.text.ShowText.process(ShowText.java:56) > ~[pdfbox-2.0.25.jar:2.0.25] > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:939) > ~[pdfbox-2.0.25.jar:2.0.25] > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:514) > ~[pdfbox-2.0.25.jar:2.0.25] > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:492) > ~[pdfbox-2.0.25.jar:2.0.25] > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:155) > ~[pdfbox-2.0.25.jar:2.0.25] > at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:282) > ~[pdfbox-2.0.25.jar:2.0.25] > at > org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:355) > ~[pdfbox-2.0.25.jar:2.0.25] > at > org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:272) > ~[pdfbox-2.0.25.jar:2.0.25] > at > org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:258) > ~[pdfbox-2.0.25.jar:2.0.25]{code} > This is a bit strange, since I thought that this bug was fixed with > PDFBOX-3488 > PdfBox is running on a linux server but when I tried to access the PDFs I > failed to find the right one (over 1 million docs on that server). > On the other hand the fix linked in the ticket points to the following > implementation: > > {code:java} > @Override > public GeneralPath getPath(int code) throws IOException{ > if (ttf.getGlyph() == null){ > throw new IOException("glyf table is missing in font " + getName()); > } {code} > which does not exist anymore in 2.0.3 or higher: > > {code:java} > @Override > public GeneralPath getPath(int code) throws IOException{ > int gid = codeToGID(code); > GlyphData glyph = ttf.getGlyph().getGlyph(gid); {code} > Any idea why an NPE might occur? > `ttf` might be null or `getGlyph` returns null? > -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org