From 802f50a7842ff3afb69bb461b0819760f866893b Mon Sep 17 00:00:00 2001 From: Glen Stampoultzis Date: Sun, 21 Sep 2003 09:58:24 +0000 Subject: [PATCH] Fixed bug relating to rewriting empty workbooks. The aggregates were not being added to the records in this case. git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/branches/REL_2_BRANCH@353363 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/poi/hssf/model/Sheet.java | 29 +++++++++--------- .../apache/poi/hssf/data/blankworkbook.xls | Bin 0 -> 13824 bytes 2 files changed, 14 insertions(+), 15 deletions(-) create mode 100644 src/testcases/org/apache/poi/hssf/data/blankworkbook.xls diff --git a/src/java/org/apache/poi/hssf/model/Sheet.java b/src/java/org/apache/poi/hssf/model/Sheet.java index 93eb1cd28d..c0f07b829a 100644 --- a/src/java/org/apache/poi/hssf/model/Sheet.java +++ b/src/java/org/apache/poi/hssf/model/Sheet.java @@ -235,9 +235,9 @@ public class Sheet implements Model } else if ( rec.getSid() == RowRecord.sid ) { - RowRecord row = (RowRecord)rec; - if (!isfirstrow) rec = null; //only add the aggregate once - + RowRecord row = (RowRecord)rec; + if (!isfirstrow) rec = null; //only add the aggregate once + if ( isfirstrow ) { retval.rows = new RowRecordsAggregate(); @@ -297,14 +297,16 @@ public class Sheet implements Model } } retval.records = records; - if (retval.rows == null) - { - retval.rows = new RowRecordsAggregate(); - } - if (retval.cells == null) - { - retval.cells = new ValueRecordsAggregate(); - } +// if (retval.rows == null) +// { +// retval.rows = new RowRecordsAggregate(); +// } + retval.checkCells(); + retval.checkRows(); +// if (retval.cells == null) +// { +// retval.cells = new ValueRecordsAggregate(); +// } log.log(log.DEBUG, "sheet createSheet (existing file) exited"); return retval; } @@ -1002,10 +1004,7 @@ public class Sheet implements Model { checkCells(); log.logFormatted(log.DEBUG, "remove value record row,dimsloc %,%", - new int[] - { - row, dimsloc - }); + new int[]{row, dimsloc} ); loc = dimsloc; cells.removeCell(col); diff --git a/src/testcases/org/apache/poi/hssf/data/blankworkbook.xls b/src/testcases/org/apache/poi/hssf/data/blankworkbook.xls new file mode 100644 index 0000000000000000000000000000000000000000..fcf734d6a8b9cef07d1e51f3eca7c9567d1da1f5 GIT binary patch literal 13824 zcmeHOYiv|S6h6D%?Ssd%-IiJ*Y}OV9`oK%e%Rp&?B9uU>v1o!w>mUq7V`_8pUWtlqkfQ`UArwV89SkjGAcpfdmtf!uox4@9l02l_DV`nX@_b z_|BO-XU@!>duQhEv7_moyFVUwUV70qNs=3}G)Ydt9Y{ZH=e+`XEXJ%IXCn;y^x0+7Ws%28sGqn4!Xtl-@y88Ka&wI-wS{)l z?;3$V!JTCTQ=VHGTCp@y!7nMiEp3IdMq+v7{H|O{6@O2SURP0S6C_UzksvG23n)v1 zg{Cd>tR>AU%z-ReSQaewy9#8CjAFsKT5Up_cn|#&DG+o`Vnr~ZS6wC&udcK-Ug3Dj zm&X$-v`bs{+eKBi@p7G#se1L#SU|;Qa40~W9j@@pw&#_l5JSx6*%*afbxh zJd139=9_-F(i}*$SWWP_!KR5aEifgS+Syx*52&ncNWZje(k%?dXFq@gQ7qX{u9Ra=*>2~l3)JI;ir8oN6 zE=&y~trEtJxK@@U4kI2bZI~Nr#obfg#wOzj*h~AJuz@k#YUgcPe`;bmn>umL&A(O~ z`wsX7ty1Ka4z%Z6)uyb+t|=eyg`9ML>N>*%`EjH#0qa7{fw1j#k}7j@Ph580(z*Pl zPd=NJWKf^=0TyC*eQQp8R9zP#=Qv>hHbKugXx5n`RT6?{>k&3~moj82FQh0#yjF^K zj=X_!03UI@d}`%iu<{%~OVCp^BIFf=>8xjK49-nkk!Siuu*Mkhl-JlatOGT-Dm})` zQ}4iWPq&QMnFE}Z3Y{(o+-1==3%B#7R>Fn04?XHJ_&&k1g^1biWM``sq0MYJuSKi` zTsgN!`G@vie5S^@;OdZhz-cej#F(d^2W2xYzX4M8`vR|##(`qdNW@iVeRA}O$9NmI zunn8vHQPWHyS$CffzDj$Qg%C<=QjH-6N;VSE|g_mq{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