aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache
diff options
context:
space:
mode:
authorJosh Micich <josh@apache.org>2008-12-16 05:44:32 +0000
committerJosh Micich <josh@apache.org>2008-12-16 05:44:32 +0000
commitfdc5f9a25cb7a1c3800d16d653fe395cab1b65cb (patch)
tree7efd643f4b392532d614796a9e20a21ee442bb75 /src/java/org/apache
parentf50adf36d183f2d29cf4110bcb539a9e3dc5dce1 (diff)
downloadpoi-fdc5f9a25cb7a1c3800d16d653fe395cab1b65cb.tar.gz
poi-fdc5f9a25cb7a1c3800d16d653fe395cab1b65cb.zip
Fix for bug 46385 (by patch 46362 from Matsuyama Tomohiro) fixed serialization of StyleRecord with unicode name
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@726969 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
-rw-r--r--src/java/org/apache/poi/hssf/record/StandardRecord.java3
-rw-r--r--src/java/org/apache/poi/hssf/record/StyleRecord.java6
2 files changed, 7 insertions, 2 deletions
diff --git a/src/java/org/apache/poi/hssf/record/StandardRecord.java b/src/java/org/apache/poi/hssf/record/StandardRecord.java
index b94c3f8164..d26f11a10b 100644
--- a/src/java/org/apache/poi/hssf/record/StandardRecord.java
+++ b/src/java/org/apache/poi/hssf/record/StandardRecord.java
@@ -40,7 +40,8 @@ public abstract class StandardRecord extends Record {
out.writeShort(dataSize);
serialize(out);
if (out.getWriteIndex() - offset != recSize) {
- throw new IllegalStateException("Incorrect number of bytes written - expected "
+ throw new IllegalStateException("Error in serialization of (" + getClass().getName() + "): "
+ + "Incorrect number of bytes written - expected "
+ recSize + " but got " + (out.getWriteIndex() - offset));
}
return recSize;
diff --git a/src/java/org/apache/poi/hssf/record/StyleRecord.java b/src/java/org/apache/poi/hssf/record/StyleRecord.java
index f9541d5939..ef2f703617 100644
--- a/src/java/org/apache/poi/hssf/record/StyleRecord.java
+++ b/src/java/org/apache/poi/hssf/record/StyleRecord.java
@@ -173,7 +173,11 @@ public final class StyleRecord extends StandardRecord {
} else {
out.writeShort(field_4_name.length());
out.writeByte(field_3_stringHasMultibyte ? 0x01 : 0x00);
- StringUtil.putCompressedUnicode(getName(), out);
+ if (field_3_stringHasMultibyte) {
+ StringUtil.putUnicodeLE(getName(), out);
+ } else {
+ StringUtil.putCompressedUnicode(getName(), out);
+ }
}
}