Fix bug #44593 - improved handling of short DVRecords
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@636756 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6025d98504
commit
709c487a42
@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
<!-- Don't forget to update status.xml too! -->
|
<!-- Don't forget to update status.xml too! -->
|
||||||
<release version="3.1-beta1" date="2008-??-??">
|
<release version="3.1-beta1" date="2008-??-??">
|
||||||
|
<action dev="POI-DEVELOPERS" type="add">44593 - Improved handling of short DVRecords</actions>
|
||||||
<action dev="POI-DEVELOPERS" type="add">28627 / 44580 - Fix Range.delete() in HWPF</action>
|
<action dev="POI-DEVELOPERS" type="add">28627 / 44580 - Fix Range.delete() in HWPF</action>
|
||||||
<action dev="POI-DEVELOPERS" type="add">44539 - Support for area references in formulas of rows >= 32768</action>
|
<action dev="POI-DEVELOPERS" type="add">44539 - Support for area references in formulas of rows >= 32768</action>
|
||||||
<action dev="POI-DEVELOPERS" type="add">44536 - Improved support for detecting read-only recommended files</action>
|
<action dev="POI-DEVELOPERS" type="add">44536 - Improved support for detecting read-only recommended files</action>
|
||||||
|
@ -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.1-beta1" date="2008-??-??">
|
<release version="3.1-beta1" date="2008-??-??">
|
||||||
|
<action dev="POI-DEVELOPERS" type="add">44593 - Improved handling of short DVRecords</actions>
|
||||||
<action dev="POI-DEVELOPERS" type="add">28627 / 44580 - Fix Range.delete() in HWPF</action>
|
<action dev="POI-DEVELOPERS" type="add">28627 / 44580 - Fix Range.delete() in HWPF</action>
|
||||||
<action dev="POI-DEVELOPERS" type="add">44539 - Support for area references in formulas of rows >= 32768</action>
|
<action dev="POI-DEVELOPERS" type="add">44539 - Support for area references in formulas of rows >= 32768</action>
|
||||||
<action dev="POI-DEVELOPERS" type="add">44536 - Improved support for detecting read-only recommended files</action>
|
<action dev="POI-DEVELOPERS" type="add">44536 - Improved support for detecting read-only recommended files</action>
|
||||||
|
@ -18,6 +18,9 @@ package org.apache.poi.hssf.util;
|
|||||||
|
|
||||||
import org.apache.poi.hssf.record.RecordInputStream;
|
import org.apache.poi.hssf.record.RecordInputStream;
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
|
import org.apache.poi.util.POILogFactory;
|
||||||
|
import org.apache.poi.util.POILogger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,6 +41,8 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
public class HSSFCellRangeAddress
|
public class HSSFCellRangeAddress
|
||||||
{
|
{
|
||||||
|
private static POILogger logger = POILogFactory.getLogger(HSSFCellRangeAddress.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of following ADDR structures
|
* Number of following ADDR structures
|
||||||
*/
|
*/
|
||||||
@ -74,8 +79,19 @@ public class HSSFCellRangeAddress
|
|||||||
{
|
{
|
||||||
short first_row = in.readShort();
|
short first_row = in.readShort();
|
||||||
short first_col = in.readShort();
|
short first_col = in.readShort();
|
||||||
short last_row = in.readShort();
|
|
||||||
short last_col = in.readShort();
|
short last_row = first_row;
|
||||||
|
short last_col = first_col;
|
||||||
|
if(in.remaining() >= 4) {
|
||||||
|
last_row = in.readShort();
|
||||||
|
last_col = in.readShort();
|
||||||
|
} else {
|
||||||
|
// Ran out of data
|
||||||
|
// For now, issue a warning, finish, and
|
||||||
|
// hope for the best....
|
||||||
|
logger.log(POILogger.WARN, "Ran out of data reading cell references for DVRecord");
|
||||||
|
k = this.field_addr_number;
|
||||||
|
}
|
||||||
|
|
||||||
AddrStructure region = new AddrStructure(first_row, first_col, last_row, last_col);
|
AddrStructure region = new AddrStructure(first_row, first_col, last_row, last_col);
|
||||||
this.field_regions_list.add(region);
|
this.field_regions_list.add(region);
|
||||||
|
BIN
src/testcases/org/apache/poi/hssf/data/Bug44593.xls
Normal file
BIN
src/testcases/org/apache/poi/hssf/data/Bug44593.xls
Normal file
Binary file not shown.
@ -1127,6 +1127,23 @@ extends TestCase {
|
|||||||
in.close();
|
in.close();
|
||||||
assertFalse(wb.isWriteProtected());
|
assertFalse(wb.isWriteProtected());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Some files were having problems with the DVRecord,
|
||||||
|
* probably due to dropdowns
|
||||||
|
*/
|
||||||
|
public void test44593() throws Exception {
|
||||||
|
FileInputStream in = new FileInputStream(new File(cwd, "Bug44593.xls"));
|
||||||
|
|
||||||
|
// Used to blow up with an IllegalArgumentException
|
||||||
|
// when creating a DVRecord
|
||||||
|
// Now won't, but no idea if this means we have
|
||||||
|
// rubbish in the DVRecord or not...
|
||||||
|
HSSFWorkbook wb = new HSSFWorkbook(in);
|
||||||
|
in.close();
|
||||||
|
|
||||||
|
assertEquals(2, wb.getNumberOfSheets());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user