From: Jason Height Date: Thu, 5 Jan 2006 07:29:36 +0000 (+0000) Subject: Multiple clone of same sheet now generates unique sheet name BUG 37416 fixed. X-Git-Tag: REL_3_0_ALPHA3~205 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=64ea72b8952865137f35d32e7e98dec62e8b87d4;p=poi.git Multiple clone of same sheet now generates unique sheet name BUG 37416 fixed. git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@366110 13f79535-47bb-0310-9956-ffa450edef68 --- 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