Bug 46362 - Multibyte string in StyleRecord doesn't be serialized correctly
Summary: Multibyte string in StyleRecord doesn't be serialized correctly
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.5-dev
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
: 46385 (view as bug list)
Depends on:
Reported: 2008-12-07 17:11 UTC by MATSUYAMA Tomohiro
Modified: 2008-12-15 21:54 UTC (History)
1 user (show)

patch (660 bytes, patch)
2008-12-07 17:12 UTC, MATSUYAMA Tomohiro
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description MATSUYAMA Tomohiro 2008-12-07 17:11:51 UTC
Serialization error occures when write a workbook that contains multibyte string style record.

Exception in thread "main" java.lang.IllegalStateException: Incorrect number of bytes written - expected 35 but got 22
        at org.apache.poi.hssf.record.StandardRecord.serialize(StandardRecord.java:39)
        at org.apache.poi.hssf.model.Workbook.serialize(Workbook.java:953)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.getBytes(HSSFWorkbook.java:1287)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.write(HSSFWorkbook.java:1191)
        at Test.main(Test.java:22)

Maybe, it is cause of StyleRecord doesn't care about uncompressed unicode or compressed unicode by hasMultibyte.

I have attached a patch. Please check it.
Comment 1 MATSUYAMA Tomohiro 2008-12-07 17:12:57 UTC
Created attachment 23000 [details]
Comment 2 Josh Micich 2008-12-15 21:52:29 UTC
Applied in svn 726969

Thanks for the patch, Matsuyama.  JUnit updated too.
Comment 3 Josh Micich 2008-12-15 21:52:44 UTC
*** Bug 46385 has been marked as a duplicate of this bug. ***
Comment 4 Josh Micich 2008-12-15 21:54:03 UTC
(svn r726969)