You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "Tim Allison (JIRA)" <ji...@apache.org> on 2019/08/02 12:17:00 UTC

[jira] [Commented] (TIKA-2919) NullPointerException when parsing PDF with OCR and ToXMLContentHandler

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

Tim Allison commented on TIKA-2919:
-----------------------------------

Thank you for opening this issue.  Would you be able to share a bit more about how you're calling Tika to trigger this?  Is this ocr'ing of PDFs (if so, which strategy), OCR'ing of embedded images or  straight image OCR?

Thank you!

> NullPointerException when parsing PDF with OCR and ToXMLContentHandler
> ----------------------------------------------------------------------
>
>                 Key: TIKA-2919
>                 URL: https://issues.apache.org/jira/browse/TIKA-2919
>             Project: Tika
>          Issue Type: Bug
>          Components: handler, ocr
>    Affects Versions: 1.21
>            Reporter: Klemens Dickbauer
>            Priority: Major
>
> When parsing a pdf document the handler creates a structure (and fires appropriate SAX exents) that each page is wrapped into two <div> elements. The outer one of these has no parent element, so when the subsequent endElement method is called for "html", a NPE occurs when currentElement.parent is referenced:
> {code:java}
> java class ToXMLContentHandler:
> public void endElement(String uri, String localName, String qName) throws SAXException {
>     if (this.inStartElement) {
>         this.write(" />");
>         this.inStartElement = false;
>     } else {
>         this.write("</");
>         this.write(qName);
>         this.write('>');
>     }
>     this.namespaces.clear();
>     this.currentElement = this.currentElement.parent;
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)