You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by jo...@apache.org on 2009/06/18 23:01:14 UTC
svn commit: r786267 - in /poi/trunk/src:
documentation/content/xdocs/status.xml
java/org/apache/poi/hssf/record/ExternalNameRecord.java
testcases/org/apache/poi/hssf/record/TestExternalNameRecord.java
Author: josh
Date: Thu Jun 18 21:01:13 2009
New Revision: 786267
URL: http://svn.apache.org/viewvc?rev=786267&view=rev
Log:
Bugzilla 47384 - Fixed ExternalNameRecord to handle unicode names
Modified:
poi/trunk/src/documentation/content/xdocs/status.xml
poi/trunk/src/java/org/apache/poi/hssf/record/ExternalNameRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestExternalNameRecord.java
Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=786267&r1=786266&r2=786267&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Thu Jun 18 21:01:13 2009
@@ -33,6 +33,7 @@
<changes>
<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>
</release>
<release version="3.5-beta6" date="2009-06-22">
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/ExternalNameRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/ExternalNameRecord.java?rev=786267&r1=786266&r2=786267&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/ExternalNameRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/ExternalNameRecord.java Thu Jun 18 21:01:13 2009
@@ -135,8 +135,13 @@
field_1_option_flag = in.readShort();
field_2_index = in.readShort();
field_3_not_used = in.readShort();
- short nameLength = in.readShort();
- field_4_name = in.readCompressedUnicode(nameLength);
+ int nameLength = in.readUByte();
+ int multibyteFlag = in.readUByte();
+ if (multibyteFlag == 0) {
+ field_4_name = in.readCompressedUnicode(nameLength);
+ } else {
+ field_4_name = in.readUnicodeLEString(nameLength);
+ }
if(!hasFormula()) {
if (!isStdDocumentNameIdentifier() && !isOLELink() && isAutomaticLink()) {
// both need to be incremented
Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/TestExternalNameRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/TestExternalNameRecord.java?rev=786267&r1=786266&r2=786267&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/TestExternalNameRecord.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/TestExternalNameRecord.java Thu Jun 18 21:01:13 2009
@@ -135,4 +135,28 @@
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());
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org