Bug 42570

Summary: NullPointerException in HSSFWorkbook.convertLabelRecords
Product: POI Reporter: Youval <youval_b>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal CC: juergen.wehren
Priority: P2    
Version: 3.0-FINAL   
Target Milestone: ---   
Hardware: Other   
OS: other   
Attachments: Test spreadsheet
Possible patch (probably not generally applicable)

Description Youval 2007-06-03 01:37:40 UTC
Trying to read the attached spreadsheet results in a NullPointerExcepion,
apparently because convertLabelRecords passes a null string to the constructor
of UnicodeString (see stack trace below).

The problem seems to be related to a chart that relies on broken references to
other spreadsheets.

For my application's purposes, I've created a patch that replaces the null
string with an empty one.  This seems to work in the specific case, but doesn't
seem like a good solution in general.

java.lang.NullPointerException
	at org.apache.poi.hssf.record.UnicodeString.setString(UnicodeString.java:350)
	at org.apache.poi.hssf.record.UnicodeString.<init>(UnicodeString.java:104)
	at
org.apache.poi.hssf.usermodel.HSSFWorkbook.convertLabelRecords(HSSFWorkbook.java:304)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:213)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:153)
	at tersus.poi.tests.ReadExcelFile.main(ReadExcelFile.java:32)
Comment 1 Youval 2007-06-03 01:41:16 UTC
Created attachment 20305 [details]
Test spreadsheet
Comment 2 Youval 2007-06-03 01:42:57 UTC
Created attachment 20306 [details]
Possible patch (probably not generally applicable)
Comment 3 Josh Micich 2008-05-05 20:58:45 UTC
Fixed in svn r653675.

Trapped null a bit earlier (in LabelRecord's constructor) -used empty string instead.  Added junit.
Comment 4 Josh Micich 2009-01-29 16:24:39 UTC
*** Bug 46575 has been marked as a duplicate of this bug. ***