<!-- Don't forget to update status.xml too! -->
<release version="3.5-beta5" date="2008-??-??">
+ <action dev="POI-DEVELOPERS" type="fix">46385 - (also patch 46362) fix serialization of StyleRecord with unicode name</action>
<action dev="POI-DEVELOPERS" type="fix">46368 - Fix HSSFRichTextRun and strings longer than 32768 characters</action>
<action dev="POI-DEVELOPERS" type="add">Support sheet-level names</action>
<action dev="POI-DEVELOPERS" type="fix">Fixed XSSFCell to properly handle cell references with column numbers up to XFD</action>
<!-- Don't forget to update changes.xml too! -->
<changes>
<release version="3.5-beta5" date="2008-??-??">
+ <action dev="POI-DEVELOPERS" type="fix">46385 - (also patch 46362) fix serialization of StyleRecord with unicode name</action>
<action dev="POI-DEVELOPERS" type="fix">46368 - Fix HSSFRichTextRun and strings longer than 32768 characters</action>
<action dev="POI-DEVELOPERS" type="add">Support sheet-level names</action>
<action dev="POI-DEVELOPERS" type="fix">Fixed XSSFCell to properly handle cell references with column numbers up to XFD</action>
\r
package org.apache.poi.hssf.record;\r
\r
+import junit.framework.AssertionFailedError;\r
import junit.framework.TestCase;\r
+\r
+import org.apache.poi.util.HexRead;\r
+\r
/**\r
- * \r
+ * Tests for {@link StyleRecord}\r
*/\r
public final class TestStyleRecord extends TestCase {\r
- public void testUnicodeReadName() {\r
- byte[] data = {\r
- 17, 0, 9, 0, 1, 56, 94, -60, -119, 95, 0, 83, 0, 104, 0, 101, 0, 101, 0, 116, 0, 49, 0, 92, 40, //92, 36 \r
- };\r
- RecordInputStream in = TestcaseRecordInputStream.create(StyleRecord.sid, data);\r
- StyleRecord sr = new StyleRecord(in);\r
- assertEquals("\u5E38\u89C4_Sheet1", sr.getName()); // "<Conventional>_Sheet1"\r
- }\r
+ public void testUnicodeReadName() {\r
+ byte[] data = HexRead.readFromString(\r
+ "11 00 09 00 01 38 5E C4 89 5F 00 53 00 68 00 65 00 65 00 74 00 31 00");\r
+ RecordInputStream in = TestcaseRecordInputStream.create(StyleRecord.sid, data);\r
+ StyleRecord sr = new StyleRecord(in);\r
+ assertEquals("\u5E38\u89C4_Sheet1", sr.getName()); // "<Conventional>_Sheet1"\r
+ byte[] ser;\r
+ try {\r
+ ser = sr.serialize();\r
+ } catch (IllegalStateException e) {\r
+ if (e.getMessage().equals("Incorrect number of bytes written - expected 27 but got 18")) {\r
+ throw new AssertionFailedError("Identified bug 46385");\r
+ }\r
+ throw e;\r
+ }\r
+ TestcaseRecordInputStream.confirmRecordEncoding(StyleRecord.sid, data, ser);\r
+ }\r
}\r