Bug 44003 - HWPF NullPointerException ListEntry.java:38
Summary: HWPF NullPointerException ListEntry.java:38
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HWPF (show other bugs)
Version: 3.0-dev
Hardware: PC Windows XP
: P2 blocker (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-30 15:00 UTC by Robert PASTOR
Modified: 2007-12-04 03:42 UTC (History)
0 users



Attachments
Small Microsoft Word 2000 File with a Table in it. (19.00 KB, application/octet-stream)
2007-11-30 15:08 UTC, Robert PASTOR
Details
Very focused file provoking the error (19.00 KB, application/octet-stream)
2007-12-01 05:45 UTC, Robert PASTOR
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert PASTOR 2007-11-30 15:00:09 UTC
I get java.lang.NullPointerException
	at org.apache.poi.hwpf.usermodel.ListEntry.<init>(ListEntry.java:38)
	at org.apache.poi.hwpf.usermodel.Range.getParagraph(Range.java:648)
while looping through the paragraphs of a Table in a WORD 2000 document.
Comment 1 Robert PASTOR 2007-11-30 15:08:23 UTC
Created attachment 21211 [details]
Small Microsoft Word 2000 File with a Table in it.

Using JAKARTA POI 3.0.1 or 3.0.0, I get java.lang.NullPointerException
	at org.apache.poi.hwpf.usermodel.ListEntry.<init>(ListEntry.java:38)
	at org.apache.poi.hwpf.usermodel.Range.getParagraph(Range.java:648)
when I loop through the sections and paragraphs of the attached doc.

Range r = doc.getRange();
StyleSheet styleSheet = doc.getStyleSheet();
for (int x = 0; x < r.numSections(); x++) {
Section s = r.getSection(x);
for (int y = 0; y < s.numParagraphs(); y++) {
Paragraph paragraph = s.getParagraph(y);
System.out.println(paragraph.getCharacterRun(0).text());
Comment 2 Robert PASTOR 2007-12-01 05:45:39 UTC
Created attachment 21213 [details]
Very focused file provoking the error
Comment 3 Nick Burch 2007-12-04 03:42:21 UTC
I've put a workaround in place, your test code now works and outputs the text of
your test file.