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

Raimund Merkert commented on TIKA-633:
--------------------------------------

{code} 
    /**
     * @see org.apache.poi.xwpf.extractor.XWPFWordExtractor#getText()
     */
    @Override
    protected void buildXHTML(XHTMLContentHandler xhtml)
            throws SAXException, XmlException, IOException {
        XWPFHeaderFooterPolicy hfPolicy = document.getHeaderFooterPolicy();

        // headers
        if (hfPolicy!=null) {
            extractHeaders(xhtml, hfPolicy);
        }

        // process text in the order that it occurs in
        extractIBodyText(document, xhtml);


        // then all document tables
        if (hfPolicy!=null) {
            extractFooters(xhtml, hfPolicy);
        }
    }
{code} 

> NPE in XWPFWordExtractorDecorator.extractHeaders
> ------------------------------------------------
>
>                 Key: TIKA-633
>                 URL: https://issues.apache.org/jira/browse/TIKA-633
>             Project: Tika
>          Issue Type: Bug
>          Components: parser
>    Affects Versions: 0.9
>            Reporter: Raimund Merkert
>         Attachments: Fails.docx
>
>
> I've got an word document (docx) that was written by POI-3.7 and I'm trying 
> to read it back in and I'm getting this NPE:
> Caused by: java.lang.NullPointerException
>       at 
> org.apache.tika.parser.microsoft.ooxml.XWPFWordExtractorDecorator.extractHeaders(XWPFWordExtractorDecorator.java:234)
>       at 
> org.apache.tika.parser.microsoft.ooxml.XWPFWordExtractorDecorator.buildXHTML(XWPFWordExtractorDecorator.java:71)
>       at 
> org.apache.tika.parser.microsoft.ooxml.AbstractOOXMLExtractor.getXHTML(AbstractOOXMLExtractor.java:99)
>       at 
> org.apache.tika.parser.microsoft.ooxml.OOXMLExtractorFactory.parse(OOXMLExtractorFactory.java:83)
>       at 
> org.apache.tika.parser.microsoft.ooxml.OOXMLParser.parse(OOXMLParser.java:67)
>       at 
> org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:197)
> From what I can see, a document may not necessarily have a headerfooterpolicy.

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

Reply via email to