From: Avik Sengupta Date: Sun, 27 Jul 2003 18:49:52 +0000 (+0000) Subject: MERGE from REL_2_BRANCH: Bug id 21027 X-Git-Tag: PERF_BEFORE_MERGE~224 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=869ac1ecb6af6a1f3c0b6d1c85cca6bea0c4a0bd;p=poi.git MERGE from REL_2_BRANCH: Bug id 21027 Patch to fix misc clone issues, submitted by Nial Pemberton git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353258 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/hssf/record/ContinueRecord.java b/src/java/org/apache/poi/hssf/record/ContinueRecord.java index dbe00e52eb..8d7eee7f72 100644 --- a/src/java/org/apache/poi/hssf/record/ContinueRecord.java +++ b/src/java/org/apache/poi/hssf/record/ContinueRecord.java @@ -267,4 +267,14 @@ public class ContinueRecord protected void fillFields(byte [] ignored_parm1, short ignored_parm2, int ignored_parm3) { } + + /** + * Clone this record. + */ + public Object clone() { + ContinueRecord clone = new ContinueRecord(); + clone.setData(field_1_data); + return clone; + } + } diff --git a/src/java/org/apache/poi/hssf/record/FormulaRecord.java b/src/java/org/apache/poi/hssf/record/FormulaRecord.java index 228aa65923..661c99eb21 100644 --- a/src/java/org/apache/poi/hssf/record/FormulaRecord.java +++ b/src/java/org/apache/poi/hssf/record/FormulaRecord.java @@ -565,8 +565,13 @@ public class FormulaRecord .append("\n"); buffer.append(" .xf = ") .append(Integer.toHexString(getXFIndex())).append("\n"); - buffer.append(" .value = ").append(getValue()) - .append("\n"); + if (Double.isNaN(this.getValue()) && value_data != null) + buffer.append(" .value (NaN) = ") + .append(org.apache.poi.util.HexDump.dump(value_data,0,0)) + .append("\n"); + else + buffer.append(" .value = ").append(getValue()) + .append("\n"); buffer.append(" .options = ").append(getOptions()) .append("\n"); buffer.append(" .zero = ").append(field_6_zero) @@ -618,6 +623,7 @@ public class FormulaRecord Ptg ptg = (Ptg)((Ptg)field_8_parsed_expr.get(i)).clone(); rec.field_8_parsed_expr.add(i, ptg); } + rec.value_data = value_data; rec.all_data = all_data; return rec; } diff --git a/src/java/org/apache/poi/hssf/record/PasswordRecord.java b/src/java/org/apache/poi/hssf/record/PasswordRecord.java index 9feb6a2cbd..ba9cbfc5f0 100644 --- a/src/java/org/apache/poi/hssf/record/PasswordRecord.java +++ b/src/java/org/apache/poi/hssf/record/PasswordRecord.java @@ -166,4 +166,14 @@ public class PasswordRecord { return this.sid; } + + /** + * Clone this record. + */ + public Object clone() { + PasswordRecord clone = new PasswordRecord(); + clone.setPassword(field_1_password); + return clone; + } + } diff --git a/src/java/org/apache/poi/hssf/record/formula/Area3DPtg.java b/src/java/org/apache/poi/hssf/record/formula/Area3DPtg.java index 1e425669db..e8a6317bd1 100644 --- a/src/java/org/apache/poi/hssf/record/formula/Area3DPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/Area3DPtg.java @@ -318,6 +318,7 @@ public class Area3DPtg extends Ptg ptg.field_3_last_row = field_3_last_row; ptg.field_4_first_column = field_4_first_column; ptg.field_5_last_column = field_5_last_column; + ptg.setClass(ptgClass); return ptg; } diff --git a/src/java/org/apache/poi/hssf/record/formula/AreaPtg.java b/src/java/org/apache/poi/hssf/record/formula/AreaPtg.java index 87ebb2c769..4f994151d6 100644 --- a/src/java/org/apache/poi/hssf/record/formula/AreaPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/AreaPtg.java @@ -321,6 +321,7 @@ public class AreaPtg ptg.field_2_last_row = field_2_last_row; ptg.field_3_first_column = field_3_first_column; ptg.field_4_last_column = field_4_last_column; + ptg.setClass(ptgClass); return ptg; } diff --git a/src/java/org/apache/poi/hssf/record/formula/FuncPtg.java b/src/java/org/apache/poi/hssf/record/formula/FuncPtg.java index 1c230c95a4..713d200b2d 100644 --- a/src/java/org/apache/poi/hssf/record/formula/FuncPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/FuncPtg.java @@ -63,7 +63,8 @@ public class FuncPtg extends AbstractFunctionPtg{ FuncPtg ptg = new FuncPtg(); //ptg.field_1_num_args = field_1_num_args; ptg.field_2_fnc_index = field_2_fnc_index; - return ptg; + ptg.setClass(ptgClass); + return ptg; } public int getSize() { diff --git a/src/java/org/apache/poi/hssf/record/formula/FuncVarPtg.java b/src/java/org/apache/poi/hssf/record/formula/FuncVarPtg.java index f333ba694e..6bf4d7f540 100644 --- a/src/java/org/apache/poi/hssf/record/formula/FuncVarPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/FuncVarPtg.java @@ -52,6 +52,7 @@ public class FuncVarPtg extends AbstractFunctionPtg{ FuncVarPtg ptg = new FuncVarPtg(); ptg.field_1_num_args = field_1_num_args; ptg.field_2_fnc_index = field_2_fnc_index; + ptg.setClass(ptgClass); return ptg; } diff --git a/src/java/org/apache/poi/hssf/record/formula/NamePtg.java b/src/java/org/apache/poi/hssf/record/formula/NamePtg.java index c926d511a1..57c6dccb59 100644 --- a/src/java/org/apache/poi/hssf/record/formula/NamePtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/NamePtg.java @@ -121,6 +121,7 @@ public class NamePtg ptg.field_1_ixti = field_1_ixti; ptg.field_2_label_index = field_2_label_index; ptg.field_3_zero = field_3_zero; + ptg.setClass(ptgClass); return ptg; } } diff --git a/src/java/org/apache/poi/hssf/record/formula/NameXPtg.java b/src/java/org/apache/poi/hssf/record/formula/NameXPtg.java index b913f438a4..58fa096866 100644 --- a/src/java/org/apache/poi/hssf/record/formula/NameXPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/NameXPtg.java @@ -102,7 +102,7 @@ public class NameXPtg extends Ptg public void writeBytes(byte [] array, int offset) { - array[ offset + 0 ] = sid; + array[ offset + 0 ] = (byte)(sid + ptgClass); LittleEndian.putShort(array, offset + 1, field_1_ixals); LittleEndian.putShort(array,offset+3, field_2_ilbl); LittleEndian.putShort(array, offset + 5, field_3_reserved); @@ -125,6 +125,7 @@ public class NameXPtg extends Ptg ptg.field_1_ixals = field_1_ixals; ptg.field_3_reserved = field_3_reserved; ptg.field_2_ilbl = field_2_ilbl; + ptg.setClass(ptgClass); return ptg; } } diff --git a/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java b/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java index a330c1bc02..13ae2ef238 100644 --- a/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java @@ -210,6 +210,7 @@ public class Ref3DPtg extends Ptg { ptg.field_1_index_extern_sheet = field_1_index_extern_sheet; ptg.field_2_row = field_2_row; ptg.field_3_column = field_3_column; + ptg.setClass(ptgClass); return ptg; } diff --git a/src/java/org/apache/poi/hssf/record/formula/ReferencePtg.java b/src/java/org/apache/poi/hssf/record/formula/ReferencePtg.java index 90f7d899c8..2ec380a4ad 100644 --- a/src/java/org/apache/poi/hssf/record/formula/ReferencePtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/ReferencePtg.java @@ -193,6 +193,7 @@ public class ReferencePtg extends Ptg ReferencePtg ptg = new ReferencePtg(); ptg.field_1_row = field_1_row; ptg.field_2_col = field_2_col; + ptg.setClass(ptgClass); return ptg; } }