Bug 45000 - ListLevel.toByteArray() can fail with a NullPointerException
Summary: ListLevel.toByteArray() can fail with a NullPointerException
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HWPF (show other bugs)
Version: 3.0-dev
Hardware: Macintosh Mac OS X 10.4
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-14 23:00 UTC by N. Hira
Modified: 2008-05-15 10:53 UTC (History)
0 users



Attachments
patch file with nullity check (899 bytes, patch)
2008-05-14 23:00 UTC, N. Hira
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description N. Hira 2008-05-14 23:00:28 UTC
Created attachment 21963 [details]
patch file with nullity check

ListLevel.toByteArray() fails with a NullPointerException with OpenOffice.org files that have Lists with no text saved using the MS Word 97 (doc) file format.

Exception in thread "main" java.lang.NullPointerException
        at org.apache.poi.hwpf.model.ListLevel.toByteArray(ListLevel.java:228)
        at org.apache.poi.hwpf.model.ListTables.writeListDataTo(ListTables.java:133)
        at org.apache.poi.hwpf.HWPFDocument.write(HWPFDocument.java:392)
        at DocumentFiller.saveFile(DocumentFiller.java:228)
        at DocumentFiller.fillDocument(DocumentFiller.java:64)
        at DocumentFiller.main(DocumentFiller.java:258)

(see attached patch file for a simple fix)
Comment 1 Josh Micich 2008-05-15 10:53:06 UTC
Applied in svn r656757.

We need a junit for this fix (TestListLevel does not exist yet).