diff --git a/src/java/org/apache/poi/hssf/record/RecordFactory.java b/src/java/org/apache/poi/hssf/record/RecordFactory.java index 544a896584..f9c86a3cec 100644 --- a/src/java/org/apache/poi/hssf/record/RecordFactory.java +++ b/src/java/org/apache/poi/hssf/record/RecordFactory.java @@ -169,7 +169,7 @@ public class RecordFactory lastDGRecord.join((AbstractEscherHolderRecord) record); } else if (record.getSid() == ContinueRecord.sid && - (lastRecord instanceof ObjRecord)) { + ((lastRecord instanceof ObjRecord) || (lastRecord instanceof TextObjectRecord))) { // Drawing records have a very strange continue behaviour. //There can actually be OBJ records mixed between the continues. lastDrawingRecord.processContinueRecord( ((ContinueRecord)record).getData() ); @@ -181,7 +181,8 @@ public class RecordFactory //Gracefully handle records that we dont know about, //that happen to be continued records.add(record); - } else throw new RecordFormatException("Unhandled Continue Record"); + } else + throw new RecordFormatException("Unhandled Continue Record"); } else { lastRecord = record; diff --git a/src/java/org/apache/poi/hssf/record/TextObjectRecord.java b/src/java/org/apache/poi/hssf/record/TextObjectRecord.java index b11f6d5748..df4c47ece4 100644 --- a/src/java/org/apache/poi/hssf/record/TextObjectRecord.java +++ b/src/java/org/apache/poi/hssf/record/TextObjectRecord.java @@ -24,7 +24,7 @@ import java.io.UnsupportedEncodingException; public class TextObjectRecord extends TextObjectBaseRecord { - HSSFRichTextString str = new HSSFRichTextString( "" ); + HSSFRichTextString str; public TextObjectRecord() { @@ -33,6 +33,8 @@ public class TextObjectRecord public TextObjectRecord( RecordInputStream in ) { super( in ); + if (str == null) + str = new HSSFRichTextString(""); } protected void fillFields(RecordInputStream in) diff --git a/src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java b/src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java index a3c62679c4..49a1cd4522 100644 --- a/src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java +++ b/src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java @@ -190,6 +190,8 @@ public class ValueRecordsAggregate /** Returns true if the row has cells attached to it */ public boolean rowHasCells(int row) { + if (row > records.length) + return false; CellValueRecordInterface[] rowCells=records[row]; if(rowCells==null) return false; for(int col=0;col