Bug 45000

Summary: ListLevel.toByteArray() can fail with a NullPointerException
Product: POI Reporter: N. Hira <nhira>
Component: HWPFAssignee: POI Developers List <dev>
Severity: normal    
Priority: P2    
Version: 3.0-dev   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X 10.4   
Attachments: patch file with nullity check

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).