https://bz.apache.org/bugzilla/show_bug.cgi?id=68236
Bug ID: 68236
Summary: searchText(String,PositionInParagraph)@XWPFParagraph
can wrongly reset BeginCharPos
Product: POI
Version: 5.3.x-dev
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: XWPF
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
The code is as follows:
public TextSegment searchText(String searched, PositionInParagraph startPos) {
...
int beginRunPos = 0, candCharPos = 0;
for (int runPos = startRun; runPos < rArray.length; runPos++) {
int beginTextPos = 0, beginCharPos = 0, textPos = 0, charPos;
....
}
beginTextPos and beginCharPos are in the loop and can be wrongly reset.
NPOI fixed a similar bug:
https://github.com/nissl-lab/npoi/commit/38cdadd3a67e59e6bede7f77996fbf048c5ffc7e
In NPOI, the fixed code is as follows:
public TextSegment SearchText(String searched, PositionInParagraph startPos){
...
int beginRunPos = 0, beginTextPos = 0, beginCharPos = 0,candCharPos = 0;
for (int runPos = startRun; runPos < paragraph.GetRList().Count; runPos++){
int beginTextPos = 0, beginCharPos = 0, textPos = 0, charPos = 0;
...
}
--
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]