You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2015/03/19 14:54:59 UTC

[Bug 57727] New: XWPFParagraph.searchText may return invalid result when searched string is in more runs

https://bz.apache.org/bugzilla/show_bug.cgi?id=57727

            Bug ID: 57727
           Summary: XWPFParagraph.searchText may return invalid result
                    when searched string is in more runs
           Product: POI
           Version: 3.12-dev
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XWPF
          Assignee: dev@poi.apache.org
          Reporter: vglasnak@seznam.cz

Run 0
TextPositon 0:

"some text"

Run 0
TextPosition 1:

"SEARCH"

Run 1
TextPosition 0:
"ED"

calling sarchText("SEARCHED", new PositionInParagraph()) returns TextSegment
with beginTextPosition == 0. because in every new run it reinitializes to 0
(XWPFParagraph.searchText source code):


        for (int runPos=startRun; runPos<rArray.length; runPos++) {
            int beginTextPos = 0,beginCharPos = 0, textPos = 0,  charPos = 0;   

Similarly for beginCharPos, both should be initialized with beginRunPos above
the cycle.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57727] XWPFParagraph.searchText may return invalid result when searched string is in more runs

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57727

Vladimir Glasnak <vg...@seznam.cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vglasnak@seznam.cz

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57727] XWPFParagraph.searchText may return invalid result when searched string is in more runs

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57727

--- Comment #4 from Florian Sommer <so...@gmx.de> ---
Sorry I still have a bug in my "fix"... I work on it, when I'm done with
everything I'll create the PR!

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57727] XWPFParagraph.searchText may return invalid result when searched string is in more runs

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57727

Florian Sommer <so...@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

--- Comment #2 from Florian Sommer <so...@gmx.de> ---
Hi, I created a testcase and a fixed version of the algorithm for this bug:

https://github.com/fsomme2s/apache-poi-bug57727

Go to test class "BeginCharTest".

Note: In this repo, I also demonstrate and fix a second bug in a second test
case. The bug is that the searchText() method returns null (= not found)
although the searched string is part of the paragraph.
I will create a second bug for this one.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57727] XWPFParagraph.searchText may return invalid result when searched string is in more runs

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57727

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57727] XWPFParagraph.searchText may return invalid result when searched string is in more runs

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57727

--- Comment #1 from Dominik Stadler <do...@gmx.at> ---
Sorry for the late response on this one, but it would make it easier to
reproduce this if you can provide both a sample file and a self-contained
unit-test, that would help a lot!

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57727] XWPFParagraph.searchText may return invalid result when searched string is in more runs

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57727

--- Comment #3 from PJ Fanning <fa...@yahoo.com> ---
Could you do a pull request in https://github.com/apache/poi with the TODOs in
your tests resolved?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org