From 9e6f2816c378f46464cbf66913eb60eff2d4cb61 Mon Sep 17 00:00:00 2001 From: Josh Micich Date: Fri, 2 May 2008 22:36:49 +0000 Subject: [PATCH] 44921 - allow Ptg.writeBytes() to be called on relative ref Ptgs (RefN* and AreaN*) git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@652934 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/changes.xml | 1 + src/documentation/content/xdocs/status.xml | 1 + .../poi/hssf/record/SharedFormulaRecord.java | 14 +++++++-- .../poi/hssf/record/formula/AreaNAPtg.java | 22 ++------------ .../poi/hssf/record/formula/AreaNPtg.java | 14 ++------- .../poi/hssf/record/formula/AreaNVPtg.java | 24 ++-------------- .../poi/hssf/record/formula/AreaPtg.java | 12 +++++--- .../poi/hssf/record/formula/RefNAPtg.java | 22 ++------------ .../poi/hssf/record/formula/RefNPtg.java | 21 ++------------ .../poi/hssf/record/formula/ReferencePtg.java | 14 ++++++++- .../apache/poi/hssf/data/ex44921-21902.xls | Bin 0 -> 39424 bytes .../hssf/record/formula/TestReferencePtg.java | 27 +++++++++++++----- 12 files changed, 70 insertions(+), 102 deletions(-) create mode 100644 src/testcases/org/apache/poi/hssf/data/ex44921-21902.xls diff --git a/src/documentation/content/xdocs/changes.xml b/src/documentation/content/xdocs/changes.xml index a295fdb22..e0fdf3966 100644 --- a/src/documentation/content/xdocs/changes.xml +++ b/src/documentation/content/xdocs/changes.xml @@ -37,6 +37,7 @@ + 44921 - allow Ptg.writeBytes() to be called on relative ref Ptgs (RefN* and AreaN*) 44914 - Fix/suppress warning message "WARN. Unread n bytes of record 0xNN" 44892 - made HSSFWorkbook.getSheet(String) case insensitive 44886] - Correctly process PICT metafile in EscherMetafileBlip diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index f97a4d7f2..f1a5cd1d8 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 44921 - allow Ptg.writeBytes() to be called on relative ref Ptgs (RefN* and AreaN*) 44914 - Fix/suppress warning message "WARN. Unread n bytes of record 0xNN" 44892 - made HSSFWorkbook.getSheet(String) case insensitive 44886] - Correctly process PICT metafile in EscherMetafileBlip diff --git a/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java b/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java index a7715474a..2b0c50d12 100755 --- a/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java +++ b/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java @@ -33,7 +33,7 @@ import org.apache.poi.hssf.record.formula.*; * @author Danny Mui at apache dot org */ public final class SharedFormulaRecord extends Record { - public final static short sid = 0x4BC; + public final static short sid = 0x4BC; private int field_1_first_row; private int field_2_last_row; @@ -186,6 +186,16 @@ public final class SharedFormulaRecord extends Record { * counter part */ protected static Stack convertSharedFormulas(Stack ptgs, int formulaRow, int formulaColumn) { + if(false) { + /* + * TODO - (May-2008) Stop converting relative ref Ptgs in shared formula records. + * If/when POI writes out the workbook, this conversion makes an unnecessary diff in the BIFF records. + * Disabling this code breaks one existing junit. + * Some fix-up will be required to make Ptg.toFormulaString(HSSFWorkbook) work properly. + * That method will need 2 extra params: rowIx and colIx. + */ + return ptgs; + } Stack newPtgStack = new Stack(); if (ptgs != null) @@ -265,7 +275,7 @@ public final class SharedFormulaRecord extends Record { throw new RuntimeException("Shared Formula Conversion: Coding Error"); } } - + private static int fixupRelativeColumn(int currentcolumn, int column, boolean relative) { if(relative) { // mask out upper bits to produce 'wrapping' at column 256 ("IV") diff --git a/src/java/org/apache/poi/hssf/record/formula/AreaNAPtg.java b/src/java/org/apache/poi/hssf/record/formula/AreaNAPtg.java index 6b0eb908a..bf3ebce87 100644 --- a/src/java/org/apache/poi/hssf/record/formula/AreaNAPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/AreaNAPtg.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -16,19 +15,9 @@ limitations under the License. ==================================================================== */ -/* - * AreaPtg.java - * - * Created on November 17, 2001, 9:30 PM - */ package org.apache.poi.hssf.record.formula; -import org.apache.poi.util.LittleEndian; -import org.apache.poi.util.BitField; - import org.apache.poi.hssf.record.RecordInputStream; -import org.apache.poi.hssf.util.AreaReference; -import org.apache.poi.hssf.util.CellReference; import org.apache.poi.hssf.usermodel.HSSFWorkbook; /** @@ -36,8 +25,7 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook; * @author Jason Height (jheight at chariot dot net dot au) */ -public class AreaNAPtg - extends AreaPtg +public final class AreaNAPtg extends AreaPtg { public final static short sid = 0x6D; @@ -50,20 +38,16 @@ public class AreaNAPtg super(in); } - public void writeBytes(byte [] array, int offset) { - throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted"); - } - public String getAreaPtgName() { return "AreaNAPtg"; } public String toFormulaString(HSSFWorkbook book) { - throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted"); + throw notImplemented(); } public Object clone() { - throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted"); + throw notImplemented(); } } diff --git a/src/java/org/apache/poi/hssf/record/formula/AreaNPtg.java b/src/java/org/apache/poi/hssf/record/formula/AreaNPtg.java index 71e413fea..b5e1ca490 100644 --- a/src/java/org/apache/poi/hssf/record/formula/AreaNPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/AreaNPtg.java @@ -36,8 +36,7 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook; * @author Jason Height (jheight at chariot dot net dot au) */ -public class AreaNPtg - extends AreaPtg +public final class AreaNPtg extends AreaPtg { public final static short sid = 0x2D; @@ -50,23 +49,16 @@ public class AreaNPtg super(in); } - public void writeBytes(byte [] array, int offset) { - super.writeBytes(array,offset); - //this should be a warning...there doesn't seem to be any rationale to throwing an exception here... - //this excpeiton appears to break user defined named ranges... - //throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted"); - } - public String getAreaPtgName() { return "AreaNPtg"; } public String toFormulaString(HSSFWorkbook book) { - throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted"); + throw notImplemented(); } public Object clone() { - throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted"); + throw notImplemented(); } } diff --git a/src/java/org/apache/poi/hssf/record/formula/AreaNVPtg.java b/src/java/org/apache/poi/hssf/record/formula/AreaNVPtg.java index 2ebf01982..d5f0c38cc 100644 --- a/src/java/org/apache/poi/hssf/record/formula/AreaNVPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/AreaNVPtg.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -16,19 +15,9 @@ limitations under the License. ==================================================================== */ -/* - * AreaPtg.java - * - * Created on November 17, 2001, 9:30 PM - */ package org.apache.poi.hssf.record.formula; -import org.apache.poi.util.LittleEndian; -import org.apache.poi.util.BitField; - import org.apache.poi.hssf.record.RecordInputStream; -import org.apache.poi.hssf.util.AreaReference; -import org.apache.poi.hssf.util.CellReference; import org.apache.poi.hssf.usermodel.HSSFWorkbook; /** @@ -36,10 +25,7 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook; * @author andy * @author Jason Height (jheight at chariot dot net dot au) */ - -public class AreaNVPtg - extends AreaPtg -{ +public final class AreaNVPtg extends AreaPtg { public final static short sid = 0x4D; protected AreaNVPtg() { @@ -51,20 +37,16 @@ public class AreaNVPtg super(in); } - public void writeBytes(byte [] array, int offset) { - throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted"); - } - public String getAreaPtgName() { return "AreaNVPtg"; } public String toFormulaString(HSSFWorkbook book) { - throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted"); + throw notImplemented(); } public Object clone() { - throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted"); + throw notImplemented(); } } 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 27e4d1759..90be1974f 100644 --- a/src/java/org/apache/poi/hssf/record/formula/AreaPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/AreaPtg.java @@ -15,7 +15,6 @@ limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record.formula; import org.apache.poi.util.LittleEndian; @@ -32,10 +31,15 @@ import org.apache.poi.hssf.record.RecordInputStream; * @author andy * @author Jason Height (jheight at chariot dot net dot au) */ +public class AreaPtg extends Ptg implements AreaI { + /** + * TODO - (May-2008) fix subclasses of AreaPtg 'AreaN~' which are used in shared formulas. + * see similar comment in ReferencePtg + */ + protected final RuntimeException notImplemented() { + return new RuntimeException("Coding Error: This method should never be called. This ptg should be converted"); + } -public class AreaPtg - extends Ptg implements AreaI -{ public final static short sid = 0x25; private final static int SIZE = 9; /** zero based, unsigned 16 bit */ diff --git a/src/java/org/apache/poi/hssf/record/formula/RefNAPtg.java b/src/java/org/apache/poi/hssf/record/formula/RefNAPtg.java index 6f18e4b94..ec09a16ab 100644 --- a/src/java/org/apache/poi/hssf/record/formula/RefNAPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/RefNAPtg.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -16,26 +15,16 @@ limitations under the License. ==================================================================== */ -/* - * ValueReferencePtg.java - * - * Created on November 21, 2001, 5:27 PM - */ package org.apache.poi.hssf.record.formula; -import org.apache.poi.util.LittleEndian; -import org.apache.poi.util.BitField; - import org.apache.poi.hssf.record.RecordInputStream; -import org.apache.poi.hssf.util.CellReference; import org.apache.poi.hssf.usermodel.HSSFWorkbook; /** * RefNAPtg * @author Jason Height (jheight at chariot dot net dot au) */ - -public class RefNAPtg extends ReferencePtg +public final class RefNAPtg extends ReferencePtg { public final static byte sid = 0x6C; @@ -48,21 +37,16 @@ public class RefNAPtg extends ReferencePtg super(in); } - public void writeBytes(byte [] array, int offset) - { - throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted"); - } - public String getRefPtgName() { return "RefNAPtg"; } public String toFormulaString(HSSFWorkbook book) { - throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted"); + throw notImplemented(); } public Object clone() { - throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted"); + throw notImplemented(); } } diff --git a/src/java/org/apache/poi/hssf/record/formula/RefNPtg.java b/src/java/org/apache/poi/hssf/record/formula/RefNPtg.java index e7522e7e5..a80d29f6d 100644 --- a/src/java/org/apache/poi/hssf/record/formula/RefNPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/RefNPtg.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -16,25 +15,16 @@ limitations under the License. ==================================================================== */ -/* - * RefNPtg.java - * - */ package org.apache.poi.hssf.record.formula; -import org.apache.poi.util.LittleEndian; -import org.apache.poi.util.BitField; - import org.apache.poi.hssf.record.RecordInputStream; -import org.apache.poi.hssf.util.CellReference; import org.apache.poi.hssf.usermodel.HSSFWorkbook; /** * RefNPtg * @author Jason Height (jheight at apache dot com) */ - -public class RefNPtg extends ReferencePtg +public final class RefNPtg extends ReferencePtg { public final static byte sid = 0x2C; @@ -49,21 +39,16 @@ public class RefNPtg extends ReferencePtg super(in); } - public void writeBytes(byte [] array, int offset) - { - throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted"); - } - public String getRefPtgName() { return "RefNPtg"; } public String toFormulaString(HSSFWorkbook book) { - throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted"); + throw notImplemented(); } public Object clone() { - throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted"); + throw notImplemented(); } } 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 3df731c7a..5fc7eaf8a 100644 --- a/src/java/org/apache/poi/hssf/record/formula/ReferencePtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/ReferencePtg.java @@ -30,8 +30,20 @@ import org.apache.poi.hssf.record.RecordInputStream; * @author Andrew C. Oliver (acoliver@apache.org) * @author Jason Height (jheight at chariot dot net dot au) */ - public class ReferencePtg extends Ptg { + /** + * TODO - (May-2008) fix subclasses of ReferencePtg 'RefN~' which are used in shared formulas. + * (See bugzilla 44921) + * The 'RefN~' instances do not work properly, and are expected to be converted by + * SharedFormulaRecord.convertSharedFormulas(). + * This conversion currently does not take place for formulas of named ranges, conditional + * format rules and data validation rules. + * Furthermore, conversion is probably not appropriate in those instances. + */ + protected final RuntimeException notImplemented() { + return new RuntimeException("Coding Error: This method should never be called. This ptg should be converted"); + } + private final static int SIZE = 5; public final static byte sid = 0x24; private final static int MAX_ROW_NUMBER = 65536; diff --git a/src/testcases/org/apache/poi/hssf/data/ex44921-21902.xls b/src/testcases/org/apache/poi/hssf/data/ex44921-21902.xls new file mode 100644 index 0000000000000000000000000000000000000000..d0fbf3cab84da324786379ab95a00dea4ac707ea GIT binary patch literal 39424 zcmeHw33yz^m2TZuOKRJ)Bpc%egME<=c+)P+3$|r#HUim_B^evyjA(UV$&FjxqPyjV z05$<ShA3W2PR<%^NsV82_d|&BxGS;7T${?d6Nkf(EI;r;sZ*y;o!ZX5{k`wbc=2QRpY>DWxi*L*@y5gyQR0GYcxI4Sr2vMC zzcDc}VL}BS|9bryN#J$x>OLO*$C$#EI?R@pd*}%P=&AvVKKsa2Jb_c8WEZhRw6VbtU_3gum)i*!i5Oy5Y{7XKxjeOh|r4AhR}}C zfzXMt31KtBMF?F8tn(%29glxeSD%REUkYu}DPp)M!~xW_@N2dxw);HwNDuI@5Xa$?2d)vKFYJR3uNpS5z=?Sq%3`surDBwx_ohf`8b<=8;Lb6r> z>B4b^xkV&Va)$__?m^LyzvRa#gp9;FOK6&gC-xKC!)({xH8;t6TX#23JG8GsJRyE0 zo|J#v#CF^}#do234dP$K)8Z-U^^<^p54ub3O}`pYKI_gtOSxvdta7cp8>b63HpHk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vLa*tuC?Ras!PZr;3$v%qNKy?EzmfziTx@o3k* zu%%gG9AUh8%d^0^)#Syi&H}5+0;|metIGnb&jM@60&C0yYsvy!nFZGDfl*s^zPC-vrlO1C|D~-C+BW^R(@OxmcH0n%`xXVndPD`Wi^x%Y4$*e}E z8D@++)PrLal~$XUMqTO=x0-2nX=&7{9&x*w#-DKEyLE~Rb*o3b*N(Z< zS~I`$j`!pDYghd73sl>OH1$RYZgOJFp}7}f8p2M5N`xyA&Ol(doQ*Js!0Fk3gffJ2 zWcK0y3#brz4KL(-DC){}UjV|Kss#|t-|di7F?`<^KiDC`<}Y=~BD4PfhGfG0Ag=tG z4N1`rXpnq3o?UXSV}1(O>$xrGs7Ukv0)-?h-RCXGZ7CFwL%l4>`Bc1|-g$r1LC%Ts z1$j}1%0pIi9!vr4h$r@_A1RRXqYOE{pp3T$NAcq-eZkm>k(7y+K#`X1(!?7RMd%GY zs>91T66Kge+{B?|OC*G!5{VC|^q%42NXXDT_lJzAZgU_zZd+t{c(tszOs(nX4=B{E S7QbKfz*UOYU;mya3H)Cx>#J`7 literal 0 HcmV?d00001 diff --git a/src/testcases/org/apache/poi/hssf/record/formula/TestReferencePtg.java b/src/testcases/org/apache/poi/hssf/record/formula/TestReferencePtg.java index 226b14400..0bddecd3f 100644 --- a/src/testcases/org/apache/poi/hssf/record/formula/TestReferencePtg.java +++ b/src/testcases/org/apache/poi/hssf/record/formula/TestReferencePtg.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -18,20 +17,22 @@ package org.apache.poi.hssf.record.formula; +import junit.framework.AssertionFailedError; +import junit.framework.TestCase; + +import org.apache.poi.hssf.HSSFTestDataSamples; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; /** * Tests for {@link ReferencePtg}. */ -public class TestReferencePtg extends AbstractPtgTestCase -{ +public final class TestReferencePtg extends TestCase { /** * Tests reading a file containing this ptg. */ - public void testReading() throws Exception - { - HSSFWorkbook workbook = loadWorkbook("ReferencePtg.xls"); + public void testReading() { + HSSFWorkbook workbook = HSSFTestDataSamples.openSampleWorkbook("ReferencePtg.xls"); HSSFSheet sheet = workbook.getSheetAt(0); // First row @@ -72,6 +73,18 @@ public class TestReferencePtg extends AbstractPtgTestCase assertEquals("Wrong formula string for reference", "A32770", sheet.getRow(32769).getCell((short) 1).getCellFormula()); } + + public void testBug44921() { + HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("ex44921-21902.xls"); + + try { + HSSFTestDataSamples.writeOutAndReadBack(wb); + } catch (RuntimeException e) { + if(e.getMessage().equals("Coding Error: This method should never be called. This ptg should be converted")) { + throw new AssertionFailedError("Identified bug 44921"); + } + throw e; + } + } } -