Fix for BOFRecord from files generated by access etc (bug #42794)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@594102 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
daf1a974a8
commit
97b7d9d758
@ -36,6 +36,7 @@
|
||||
|
||||
<!-- Don't forget to update status.xml too! -->
|
||||
<release version="3.0.2-FINAL" date="2007-??-??">
|
||||
<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">43751 - [PATCH] - Fix for handling rotated text in HSSFSheet.autoSizeColumn</action>
|
||||
<action dev="POI-DEVELOPERS" type="add">Include an Excel text extractor, and put all existing text extractors under a common superclass</action>
|
||||
|
@ -33,6 +33,7 @@
|
||||
<!-- Don't forget to update changes.xml too! -->
|
||||
<changes>
|
||||
<release version="3.0.2-FINAL" date="2007-??-??">
|
||||
<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">43751 - [PATCH] - Fix for handling rotated text in HSSFSheet.autoSizeColumn</action>
|
||||
<action dev="POI-DEVELOPERS" type="add">Include an Excel text extractor, and put all existing text extractors under a common superclass</action>
|
||||
|
@ -110,10 +110,21 @@ public class BOFRecord
|
||||
{
|
||||
field_1_version = in.readShort();
|
||||
field_2_type = in.readShort();
|
||||
field_3_build = in.readShort();
|
||||
field_4_year = in.readShort();
|
||||
field_5_history = in.readInt();
|
||||
field_6_rversion = in.readInt();
|
||||
|
||||
// Some external tools don't generate all of
|
||||
// the remaining fields
|
||||
if (in.remaining() >= 2) {
|
||||
field_3_build = in.readShort();
|
||||
}
|
||||
if (in.remaining() >= 2) {
|
||||
field_4_year = in.readShort();
|
||||
}
|
||||
if (in.remaining() >= 4) {
|
||||
field_5_history = in.readInt();
|
||||
}
|
||||
if (in.remaining() >= 4) {
|
||||
field_6_rversion = in.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
BIN
src/testcases/org/apache/poi/hssf/data/bug_42794.mdb
Normal file
BIN
src/testcases/org/apache/poi/hssf/data/bug_42794.mdb
Normal file
Binary file not shown.
BIN
src/testcases/org/apache/poi/hssf/data/bug_42794.xls
Normal file
BIN
src/testcases/org/apache/poi/hssf/data/bug_42794.xls
Normal file
Binary file not shown.
50
src/testcases/org/apache/poi/hssf/record/TestBOFRecord.java
Normal file
50
src/testcases/org/apache/poi/hssf/record/TestBOFRecord.java
Normal file
@ -0,0 +1,50 @@
|
||||
|
||||
/* ====================================================================
|
||||
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 org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class TestBOFRecord extends TestCase
|
||||
{
|
||||
private String _test_file_path;
|
||||
private static final String _test_file_path_property = "HSSF.testdata.path";
|
||||
|
||||
public TestBOFRecord()
|
||||
{
|
||||
super();
|
||||
_test_file_path = System.getProperty( _test_file_path_property ) +
|
||||
File.separator + "bug_42794.xls";
|
||||
}
|
||||
|
||||
public void testBOFRecord() throws Exception {
|
||||
POIFSFileSystem fs = new POIFSFileSystem(
|
||||
new FileInputStream(_test_file_path)
|
||||
);
|
||||
|
||||
// This used to throw an error before
|
||||
HSSFWorkbook hssf = new HSSFWorkbook(fs);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user