https://issues.apache.org/bugzilla/show_bug.cgi?id=51148
Bug #: 51148
Summary: XWPFDocument.removeBodyElement(int pos) error
Product: POI
Version: 3.7
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: major
Priority: P2
Component: XWPF
AssignedTo: [email protected]
ReportedBy: [email protected]
Classification: Unclassified
XWPFDocument.removeBodyElement(int pos) throws IndexOutOfBoundsException
whatever the value of the element index.
I think that this is caused by two XWPFDocument class code errors:
1 - In removeBodyElement(int pos), the statement:
bodyElements.remove(pos);
should be placed AFTER the statements:
Integer tablePos = getTablePos(pos);
and
Integer paraPos = getParagraphPos(pos);
instead of before, otherwise the element is not there in the bodyElements List
to be used to locate it in the paragraphs or tables Lists.
2 - In getParagraphPos(int pos) and getTablePos(int pos), the for loop should
be:
for(int i = startPos; i >= 0; i--) {
....
}
--
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: [email protected]
For additional commands, e-mail: [email protected]