Bugzilla 47384 - Fixed ExternalNameRecord to handle unicode names
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@786267 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0e3a22ae42
commit
8e010177ef
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
<changes>
|
<changes>
|
||||||
<release version="3.5-beta7" date="2009-??-??">
|
<release version="3.5-beta7" date="2009-??-??">
|
||||||
|
<action dev="POI-DEVELOPERS" type="fix">47384 - Fixed ExternalNameRecord to handle unicode names</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">47372 - Fixed locale-sensitive unit tests to pass when running on non-US locale</action>
|
<action dev="POI-DEVELOPERS" type="fix">47372 - Fixed locale-sensitive unit tests to pass when running on non-US locale</action>
|
||||||
</release>
|
</release>
|
||||||
<release version="3.5-beta6" date="2009-06-22">
|
<release version="3.5-beta6" date="2009-06-22">
|
||||||
|
@ -135,8 +135,13 @@ public final class ExternalNameRecord extends StandardRecord {
|
|||||||
field_1_option_flag = in.readShort();
|
field_1_option_flag = in.readShort();
|
||||||
field_2_index = in.readShort();
|
field_2_index = in.readShort();
|
||||||
field_3_not_used = in.readShort();
|
field_3_not_used = in.readShort();
|
||||||
short nameLength = in.readShort();
|
int nameLength = in.readUByte();
|
||||||
|
int multibyteFlag = in.readUByte();
|
||||||
|
if (multibyteFlag == 0) {
|
||||||
field_4_name = in.readCompressedUnicode(nameLength);
|
field_4_name = in.readCompressedUnicode(nameLength);
|
||||||
|
} else {
|
||||||
|
field_4_name = in.readUnicodeLEString(nameLength);
|
||||||
|
}
|
||||||
if(!hasFormula()) {
|
if(!hasFormula()) {
|
||||||
if (!isStdDocumentNameIdentifier() && !isOLELink() && isAutomaticLink()) {
|
if (!isStdDocumentNameIdentifier() && !isOLELink() && isAutomaticLink()) {
|
||||||
// both need to be incremented
|
// both need to be incremented
|
||||||
|
@ -135,4 +135,28 @@ public final class TestExternalNameRecord extends TestCase {
|
|||||||
|
|
||||||
TestcaseRecordInputStream.confirmRecordEncoding(0x0023, dataDDE, enr.serialize());
|
TestcaseRecordInputStream.confirmRecordEncoding(0x0023, dataDDE, enr.serialize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testUnicodeName_bug47384() {
|
||||||
|
// 0x13A0
|
||||||
|
byte[] dataUN = HexRead.readFromString(
|
||||||
|
"23 00 22 00" +
|
||||||
|
"00 00 00 00 00 00 " +
|
||||||
|
"0C 01 " +
|
||||||
|
"59 01 61 00 7A 00 65 00 6E 00 ED 00 5F 00 42 00 69 00 6C 00 6C 00 61 00" +
|
||||||
|
"00 00");
|
||||||
|
|
||||||
|
RecordInputStream in = TestcaseRecordInputStream.create(dataUN);
|
||||||
|
ExternalNameRecord enr;
|
||||||
|
try {
|
||||||
|
enr = new ExternalNameRecord(in);
|
||||||
|
} catch (RecordFormatException e) {
|
||||||
|
// actual msg reported in bugzilla 47229 is different
|
||||||
|
// because that seems to be using a version from before svn r646666
|
||||||
|
if (e.getMessage().startsWith("Expected to find a ContinueRecord in order to read remaining 242 of 268 chars")) {
|
||||||
|
throw new AssertionFailedError("Identified bug 47384 - failed to read ENR with unicode name");
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
assertEquals("\u0159azen\u00ED_Billa", enr.getText());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user