https://bz.apache.org/ooo/show_bug.cgi?id=107619

--- Comment #22 from hanya <[email protected]> ---
(In reply to Francis C. Costero from comment #17)
> I still see the problem with 4.1.2 and one of the original example cases. I
> have 3 cells containing
> 987
> a b
> a
> 
> With 
> Find: ([^ ]*)[ ]*([^ ]*) 
> Replace: $1$2
> I get the following after clicking Replace All
> 987987
> ab
> aa
I observed strange result with: 
A1: 987
Find and replace: written in the above
other cells: leave them empty
Click "Replace All" button. Sometimes strange result is not shown but 
if you push the button sometimes, the strange result can be observed.

It seems this problem is happen because of index out of bounds of sequence 
in TextSearch::searchForward method.
In the above case, offset sequence has [0, 1, 2] elements.
startOffset of the match: [0, 0, 3]
endOffset of the match: [3, 3, 3]

In the TextSearch::searchForward method: 
        for ( int k = 0; k < sres.startOffset.getLength(); k++ )
        {
            if (sres.startOffset[k])
          sres.startOffset[k] = offset[sres.startOffset[k]];
When k == 2, sres.startOffset[k] gives 3 to refer offset[3] which gives 
illegal value from the out of the sequence. 
If offset[3] gave large number, the result in the cell was correct. 
But offset[3] was 0, it gave 0-3 sub string for $2.
This behavior is simply broken.

I have no idea how to fix the index miss match now.

-- 
You are receiving this mail because:
You are on the CC list for the issue.
You are the assignee for the issue.

Reply via email to