[ 
https://issues.apache.org/jira/browse/ODFTOOLKIT-356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15002217#comment-15002217
 ] 

Raimund Hölle commented on ODFTOOLKIT-356:
------------------------------------------

It was my slip - my test scenario was a little bit different: I first removed 
all rows before removing the columns; in this case removeColumnsByIndex() don't 
throw an exception. The exception occured then thereafter when appending a new 
cell to the now empty table.

However, I appended a patch (based on actual trunk) which covers Florian's use 
case as well as mine. Additionally I created four new tests to validate both 
use cases (based on Florian's test proposal): HandlingEmptyTables.patch, 
HandlingEmptyTables-Test.patch

I can't agree with you that a table must contain a cell at any time. It must 
contain at least one cell when the table creation is finished (at least when 
saving the file), but it must be possible to create a new empty table without 
being forced to use predefined cells. This complicates the usage unnecessary:
* Everytime if I want to append a row or cell, I have first to check if a 
corresponding row / cell already exists and then modify that cell instead of 
just appending a new row / cell.
* I have to redefine ALL cell properties instead of just adding the properties 
I really need.

Beside, the current code allows to remove all rows and / or columns; the 
exceptions occur thereafter when the table is already modified. So it should 
either be impossible to remove all cells (not very user friendly) or the code 
should handle that correctly. I hope my patches will do that.

My use case (inlcuding the needed patch as described in my yesterdays comment) 
work already for some weeks without problems in a production eviroment to 
automatically create spreadsheet documents.

> IllegalArgumentException when removing all columns from a fresh Table
> ---------------------------------------------------------------------
>
>                 Key: ODFTOOLKIT-356
>                 URL: https://issues.apache.org/jira/browse/ODFTOOLKIT-356
>             Project: ODF Toolkit
>          Issue Type: Bug
>    Affects Versions: 0.6-incubating
>            Reporter: Florian Hopf
>            Assignee: Florian Hopf
>         Attachments: HandlingEmptyTables-Test.patch, 
> HandlingEmptyTables.patch, ODFTOOLKIT-356-Test.patch, 
> ODFTOOLKIT-356-contribution.patch
>
>
> When trying to remove all columns from the Table of a newly created 
> SpreadsheetDocument an illegal index is passed in to Row#getCellByIndex()



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to