Bug #54016 - Avoid exception when parsing workbooks with DConRefRecord in row aggregate

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1402482 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yegor Kozlov 2012-10-26 12:21:33 +00:00
parent 59b4c3e08d
commit 4575104984
4 changed files with 12 additions and 15 deletions

View File

@ -34,6 +34,7 @@
<changes>
<release version="3.9-beta1" date="2012-??-??">
<action dev="poi-developers" type="fix">54016 - Avoid exception when parsing workbooks with DConRefRecord in row aggregate</action>
<action dev="poi-developers" type="fix">54008 - Fixed Ant build to support build directories with blanks</action>
<action dev="poi-developers" type="fix">53374 - Avoid exceptions when parsing hyperlinks of type "javascript://"</action>
<action dev="poi-developers" type="fix">53404 - Fixed compatibility bug with modifying xls files created by POI-3.6 and earlier</action>

View File

@ -24,20 +24,7 @@ import java.util.Map;
import java.util.TreeMap;
import org.apache.poi.hssf.model.RecordStream;
import org.apache.poi.hssf.record.ArrayRecord;
import org.apache.poi.hssf.record.CellValueRecordInterface;
import org.apache.poi.hssf.record.ContinueRecord;
import org.apache.poi.hssf.record.DBCellRecord;
import org.apache.poi.hssf.record.DimensionsRecord;
import org.apache.poi.hssf.record.FormulaRecord;
import org.apache.poi.hssf.record.IndexRecord;
import org.apache.poi.hssf.record.MergeCellsRecord;
import org.apache.poi.hssf.record.MulBlankRecord;
import org.apache.poi.hssf.record.Record;
import org.apache.poi.hssf.record.RowRecord;
import org.apache.poi.hssf.record.SharedFormulaRecord;
import org.apache.poi.hssf.record.TableRecord;
import org.apache.poi.hssf.record.UnknownRecord;
import org.apache.poi.hssf.record.*;
import org.apache.poi.ss.formula.FormulaShifter;
import org.apache.poi.ss.SpreadsheetVersion;
@ -86,7 +73,10 @@ public final class RowRecordsAggregate extends RecordAggregate {
case RowRecord.sid:
insertRow((RowRecord) rec);
continue;
case DBCellRecord.sid:
case DConRefRecord.sid:
addUnknownRecord(rec);
continue;
case DBCellRecord.sid:
// end of 'Row Block'. Should only occur after cell records
// ignore DBCELL records because POI generates them upon re-serialization
continue;

View File

@ -2313,4 +2313,10 @@ if(1==2) {
wb = writeOutAndReadBack((HSSFWorkbook) wb);
}
public void test54016() {
// This used to break
HSSFWorkbook wb = openSample("54016.xls");
wb = HSSFTestDataSamples.writeOutAndReadBack(wb);
}
}

Binary file not shown.