Patch for unicode NameRecords (bug #43837)

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@594316 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2007-11-12 22:12:03 +00:00
parent 2038b4ba5b
commit c1a4f1c8e8
5 changed files with 63 additions and 9 deletions

View File

@ -36,6 +36,7 @@
<!-- Don't forget to update status.xml too! --> <!-- Don't forget to update status.xml too! -->
<release version="3.0.2-FINAL" date="2007-??-??"> <release version="3.0.2-FINAL" date="2007-??-??">
<action dev="POI-DEVELOPERS" type="fix">43837 - [PATCH] Support for unicode NameRecords</action>
<action dev="POI-DEVELOPERS" type="add">43721 - [PATCH] Support for Chart Title Format records</action> <action dev="POI-DEVELOPERS" type="add">43721 - [PATCH] Support for Chart Title Format records</action>
<action dev="POI-DEVELOPERS" type="fix">42794 - [PATCH] Fix for BOF records from things like Access</action> <action dev="POI-DEVELOPERS" type="fix">42794 - [PATCH] Fix for BOF records from things like Access</action>
<action dev="POI-DEVELOPERS" type="fix">43648 - Fix for IntPtg and short vs int</action> <action dev="POI-DEVELOPERS" type="fix">43648 - Fix for IntPtg and short vs int</action>

View File

@ -33,6 +33,7 @@
<!-- Don't forget to update changes.xml too! --> <!-- Don't forget to update changes.xml too! -->
<changes> <changes>
<release version="3.0.2-FINAL" date="2007-??-??"> <release version="3.0.2-FINAL" date="2007-??-??">
<action dev="POI-DEVELOPERS" type="fix">43837 - [PATCH] Support for unicode NameRecords</action>
<action dev="POI-DEVELOPERS" type="add">43721 - [PATCH] Support for Chart Title Format records</action> <action dev="POI-DEVELOPERS" type="add">43721 - [PATCH] Support for Chart Title Format records</action>
<action dev="POI-DEVELOPERS" type="fix">42794 - [PATCH] Fix for BOF records from things like Access</action> <action dev="POI-DEVELOPERS" type="fix">42794 - [PATCH] Fix for BOF records from things like Access</action>
<action dev="POI-DEVELOPERS" type="fix">43648 - Fix for IntPtg and short vs int</action> <action dev="POI-DEVELOPERS" type="fix">43648 - Fix for IntPtg and short vs int</action>

View File

@ -719,17 +719,17 @@ public class NameRecord extends Record {
field_9_length_help_topic_text = in.readByte(); field_9_length_help_topic_text = in.readByte();
field_10_length_status_bar_text = in.readByte(); field_10_length_status_bar_text = in.readByte();
//store the name in byte form if it's a builtin name //store the name in byte form if it's a builtin name
field_11_compressed_unicode_flag= in.readByte(); field_11_compressed_unicode_flag= in.readByte();
if (this.isBuiltInName()) { if (this.isBuiltInName()) {
field_12_builtIn_name = in.readByte(); field_12_builtIn_name = in.readByte();
} else { } else {
if (field_11_compressed_unicode_flag == 1) { if (field_11_compressed_unicode_flag == 1) {
field_12_name_text = in.readCompressedUnicode(field_3_length_name_text); field_12_name_text = in.readUnicodeLEString(field_3_length_name_text);
} else { } else {
field_12_name_text = in.readCompressedUnicode(field_3_length_name_text); field_12_name_text = in.readCompressedUnicode(field_3_length_name_text);
} }
} }
field_13_name_definition = Ptg.createParsedExpressionTokens(field_4_length_name_definition, in); field_13_name_definition = Ptg.createParsedExpressionTokens(field_4_length_name_definition, in);

View File

@ -0,0 +1,52 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.record;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import junit.framework.TestCase;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
public class TestUnicodeNameRecord extends TestCase {
private String _test_file_path;
private static final String _test_file_path_property = "HSSF.testdata.path";
public TestUnicodeNameRecord()
{
super();
_test_file_path = System.getProperty( _test_file_path_property ) +
File.separator + "unicodeNameRecord.xls";
}
public void testReadBook() throws IOException {
POIFSFileSystem fs = new POIFSFileSystem(
new FileInputStream(_test_file_path)
);
// This bit used to crash
HSSFWorkbook book = new HSSFWorkbook(fs);
HSSFSheet sheet = book.getSheetAt(0);
}
}