Bug 51787 - First row is duplicated in the XWPFTable constructor
Summary: First row is duplicated in the XWPFTable constructor
Alias: None
Product: POI
Classification: Unclassified
Component: XWPF (show other bugs)
Version: unspecified
Hardware: All All
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2011-09-08 13:40 UTC by Cedomir Igaly
Modified: 2016-06-12 17:17 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Cedomir Igaly 2011-09-08 13:40:25 UTC
In the case when row (or rows) is already present in tableRows, the folowing code in the constructor will anyway add it for the second time:

XWPFTableRow tabRow = (getRow(i) == null) ? createRow() : getRow(i);

I've fixed that problem by replacing the code above with:

XWPFTableRow tabRow = getRow(i);
if (tabRow == null) {
	tabRow = createRow();

and it is working for me. However, I can not guarantee that I did not misssed something important.
Comment 1 Nick Burch 2011-09-09 15:13:31 UTC
Any chance you could write a short junit unit test to go with this? We can then use it to verify the fix, and ensure it doesn't get broken again in future
Comment 2 Dominik Stadler 2016-06-12 17:17:44 UTC
I could not find this in the code any more, it seems to have been fixed at some point, however I do not even find the code this way if I look at historical versions of XWPFTable, so not sure which version the suggested patch did target here...