You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2009/01/21 12:54:25 UTC

DO NOT REPLY [Bug 46575] New: [PATCH]NullPointerException in HSSFWorkbook.convertLabelRecords

https://issues.apache.org/bugzilla/show_bug.cgi?id=46575

           Summary: [PATCH]NullPointerException in
                    HSSFWorkbook.convertLabelRecords
           Product: POI
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: juergen.wehren@framesoft.com


Created an attachment (id=23147)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23147)
Patch for NPX in HSSFWorkbook.convertLabelRecords()

When reading an Excel Sheet with an embedded Excel Diagram a Nullpointer
Exception occurs at HSSFWorkbook.convertLabelRecords:

Caused by: java.lang.NullPointerException
        at
org.apache.poi.hssf.record.UnicodeString.setString(UnicodeString.java:343)
        at
org.apache.poi.hssf.record.UnicodeString.<init>(UnicodeString.java:104)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.convertLabelRecords(HSSFWorkbook.java:303)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:215)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:259)
        at
com.framesoft.ffr.dms.lucene.documentHandler.ExcelPoiHSSFHandler.getDocumentContent(ExcelPoiHSSFHandler.java:25)
        ... 1 more

I fixed this issue for our project where we extract the text from multiple
Excel Documents by changing this Line:

workbook.addSSTString(new UnicodeString(oldrec.getValue()));

with this Line:

workbook.addSSTString((oldrec.getValue() == null ? null : new
UnicodeString(oldrec.getValue())));

I don't know if this is a valid solution for this issue but for us it fixed the
problem. 

Maybe there is a problem with some of the ExcelSheets we are trying to read
that have a LabelRecord with a Null value. The Nullpointer did not occur if one
of the embedded ExcelDiagrams was removed. The Diagram is referencing a Table
with an empty row, so maybe that is the reason for the problem. 

I attached an example for this diagram that will result in an NPX.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 46575] [PATCH]NullPointerException in HSSFWorkbook.convertLabelRecords

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46575





--- Comment #1 from Jürgen Wehren <ju...@framesoft.com>  2009-01-21 03:56:27 PST ---
Created an attachment (id=23148)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23148)
Excel Sheet with an embedded Diagram/Chart that will cause the NPX


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 46575] [PATCH]NullPointerException in HSSFWorkbook.convertLabelRecords

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46575


Josh Micich <jo...@gildedtree.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE




--- Comment #2 from Josh Micich <jo...@gildedtree.com>  2009-01-29 16:24:39 PST ---
The patch is specified to be applied against latest svn trunk, but the bug is
no longer visible there.  The stacktrace provided is from an old version of
POI.  The problem was fixed with bug 42570 (from version 3.1-beta2 onwards).

Please do a search first to save time in future. e.g.:
http://www.google.com/search?q=NullPointerException+convertLabelRecords

*** This bug has been marked as a duplicate of bug 42570 ***


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org