You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2008/08/31 15:55:48 UTC

DO NOT REPLY [Bug 45717] New: On sheet creation from scratch at HSSFRow.createCell(): IllegalStateException: Cannot create value records before row records exist

https://issues.apache.org/bugzilla/show_bug.cgi?id=45717

           Summary: On sheet creation from scratch at HSSFRow.createCell():
                    IllegalStateException: Cannot create value records
                    before row records exist
           Product: POI
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: c.gosch@inovex.de


On creating a new sheet from scratch, "IllegalStateException: Cannot create
value records before row records exist" is thrown when creating the first cell
using "HSSFCell cell = ((HSSFRow)row).createCell((short)0);" (after creating
workbook, sheet, row).

This happens for example when applying some basic sheet formatting and print
setup after creating the row and before actually creating the cell at the row.
It is not known which precondition is exactly required for reproducing the bug.

An example (simple JUnit test class) is attached to this bug. The stack trace
is inside the exapmle file.

Testing environment was:
IBM WebSphere 6.0.2.19 / IBM JRE 1.4.2 on WinXP-Pro SP3 and on a Linux system;
POI 3.1-FINAL-20080629

The test class was build and "tested" using Eclipse 3.4 Ganymede "EE" with the
JRE being setup to the mentioned IBM JRE 1.4.2.

There is a bug the may be related and was fixed for 3.1-FINAL-20080629: It is
45145 (https://issues.apache.org/bugzilla/show_bug.cgi?id=45145).

Regards,
-- 
c.gosch


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 45717] On sheet creation from scratch at HSSFRow.createCell(): IllegalStateException: Cannot create value records before row records exist

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45717





--- Comment #3 from Christian Gosch <c....@inovex.de>  2008-09-01 00:46:00 PST ---
Since 3.1 seems to be the current final version, is there any recommendation
for a "code-around" for this problem with 3.1, like executing the formatting
code before / behind other operations? I generally dislike using "nightly
builds" or alphas in production environments.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 45717] On sheet creation from scratch at HSSFRow.createCell(): IllegalStateException: Cannot create value records before row records exist

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45717


Josh Micich <jo...@gildedtree.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #2 from Josh Micich <jo...@gildedtree.com>  2008-08-31 09:30:43 PST ---
Retested OK on svn trunk (r690714)

Junit added in svn 690721

The cause of this bug was bad management of sheet record positions, which
caused the RowRecordsAggregate to get out of alignment.  At the time of bug
45145, the RowRecordsAggregate and ValueRecordsAggregate were very independent.
 It has since become clearer that RowRecordsAggregate should compose
ValueRecordsAggregate (fixed in r683758).  Besides the data structure problem,
this bug was also caused by a bad position adjustment when adding margins. In
svn r683871 the PageSettingsBlock was introduced, which simplified position
management of all page settings records.  The sample code / new junit appears
to relate more to the second fix, but either would have done the job.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 45717] On sheet creation from scratch at HSSFRow.createCell(): IllegalStateException: Cannot create value records before row records exist

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45717





--- Comment #5 from Christian Gosch <c....@inovex.de>  2008-09-02 00:32:58 PST ---

Final note:

I have put this on the mailing list just a few minutes earlier :-)

Besides: The reason for the order of statements was that I needed information
about how many rows the freeze pane should cover, which is data dependent here.
It was just the simplest form to implement (just create the freeze pane rows
from the header data and count, set up the freeze pane, and proceed with the
real data) -- now I inspect my data first, set up the freeze pane and create
rows and cells afterwards.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 45717] On sheet creation from scratch at HSSFRow.createCell(): IllegalStateException: Cannot create value records before row records exist

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45717





--- Comment #4 from Josh Micich <jo...@gildedtree.com>  2008-09-01 10:14:08 PST ---
To make the unit test I reduced your example down to these lines of code:

HSSFSheet sheet = workbook.createSheet("Vorschauliste");
HSSFRow row = sheet.createRow(0);            // B
sheet.setMargin(HSSFSheet.LeftMargin, 0.3);  // A 
row.createCell((short) 0);                   // C

To cause the IllegalStateException, the critical factor is to execute the three
labeled lines in the above order.  The other two possible orderings (A, B, C)
and (B, C, A) work OK.  For me, setting the sheet margins before creating rows
makes a little more sense. To be clear:

HSSFSheet sheet = workbook.createSheet("Vorschauliste");
sheet.setMargin(HSSFSheet.LeftMargin, 0.3);  // A 
HSSFRow row = sheet.createRow(0);            // B
row.createCell((short) 0);                   // C

Either re-ordering would be a 'code around' for the specific example provided. 
However there is no guarantee that this would be the only thing you need to do
to avoid the problems fixed in r683758 and r683871.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 45717] On sheet creation from scratch at HSSFRow.createCell(): IllegalStateException: Cannot create value records before row records exist

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45717





--- Comment #1 from Christian Gosch <c....@inovex.de>  2008-08-31 06:56:41 PST ---
Created an attachment (id=22503)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22503)
JUnit test class for Exception on HSSFRow.createCell(short)

JUnit test class for Exception on HSSFRow.createCell(short)


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org