Bug 59322 - Unable to process table if a table cell has a null descriptor
Summary: Unable to process table if a table cell has a null descriptor
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: HWPF (show other bugs)
Version: 3.13-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2016-04-14 15:46 UTC by adityagaitonde
Modified: 2016-05-17 19:38 UTC (History)
0 users

The sample file to reproduce the issue (39.00 KB, application/msword)
2016-04-14 15:46 UTC, adityagaitonde

Note You need to log in before you can comment on or make changes to this bug.
Description adityagaitonde 2016-04-14 15:46:03 UTC
Created attachment 33760 [details]
The sample file to reproduce the issue

If you try to process the table with a table cell having the null descriptor, we get the Null pointer exception. The sample file to reproduce the issue is also attached.


import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.HWPFDocumentCore;
import org.apache.poi.hwpf.converter.WordToHtmlConverter;
import org.w3c.dom.Document;

import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;
import java.io.FileInputStream;

public class PoiIssues {

    public static void main(String[] args) throws Exception {
        File file = new File("word-doc-with-revised-table.doc");
        FileInputStream fileInputStream = new FileInputStream(file);
        Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
        WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter(document);
        HWPFDocumentCore hwpfDocumentCore = new HWPFDocument(HWPFDocumentCore.verifyAndBuildPOIFS(fileInputStream));
        System.out.println("Process Complete");


Exception in thread "main" java.lang.NullPointerException
	at org.apache.poi.hwpf.usermodel.TableCell.isVerticallyMerged(TableCell.java:66)
	at org.apache.poi.hwpf.converter.WordToHtmlConverter.processTable(WordToHtmlConverter.java:643)
	at org.apache.poi.hwpf.converter.AbstractWordConverter.processParagraphes(AbstractWordConverter.java:1073)
	at org.apache.poi.hwpf.converter.WordToHtmlConverter.processSingleSection(WordToHtmlConverter.java:608)
	at org.apache.poi.hwpf.converter.AbstractWordConverter.processDocument(AbstractWordConverter.java:721)
	at PoiIssues.main(PoiIssues.java:20)