Bug 42570 - NullPointerException in HSSFWorkbook.convertLabelRecords
Summary: NullPointerException in HSSFWorkbook.convertLabelRecords
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-FINAL
Hardware: Other other
: P2 normal with 1 vote (vote)
Target Milestone: ---
Assignee: POI Developers List
: 46575 (view as bug list)
Depends on:
Reported: 2007-06-03 01:37 UTC by Youval
Modified: 2009-01-29 16:24 UTC (History)
1 user (show)

Test spreadsheet (188.00 KB, application/octet-stream)
2007-06-03 01:41 UTC, Youval
Possible patch (probably not generally applicable) (942 bytes, patch)
2007-06-03 01:42 UTC, Youval
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.

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