Bug 46362

Summary: Multibyte string in StyleRecord doesn't be serialized correctly
Product: POI Reporter: MATSUYAMA Tomohiro <matsuyama>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal CC: duc.nguyen
Priority: P2    
Version: 3.5-dev   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: patch

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]
patch
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)