tika-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Raimund Merkert (JIRA)" <j...@apache.org>
Subject [jira] [Issue Comment Edited] (TIKA-633) NPE in XWPFWordExtractorDecorator.extractHeaders
Date Mon, 04 Apr 2011 14:28:05 GMT

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

Raimund Merkert edited comment on TIKA-633 at 4/4/11 2:26 PM:
--------------------------------------------------------------

I fixed the code myself locally and it works, at least for my purposes.
{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} 

      was (Author: spamdaemon):
    {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

Mime
View raw message