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 2018/09/30 02:05:41 UTC

[Bug 62779] New: Paragraph text search results start with an error marker.

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

            Bug ID: 62779
           Summary: Paragraph text search results start with an error
                    marker.
           Product: POI
           Version: 4.0.0-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XWPF
          Assignee: dev@poi.apache.org
          Reporter: 1042126743@qq.com
  Target Milestone: ---

Created attachment 36177
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36177&action=edit
Fix the sample

Fix paragraph text search results start point marking error.

##src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java
Each loop of rArray in the searchText method causes beginTextPos and
beginCharPos to be reset accordingly. The resulting TextSegment returns invalid
data.

Such as:
Search ${code} in Runs data ["code:${", "code","}"].
The correct result returned should be

### start
startRun 0
startText 0
startChar 5
### end
endRun 2
endText 0
endChar 0
But the actual interior only retains the startRun state, and startText,
startChar are reset at each loop.

startRun 0
startText 0
startChar 0

-- 
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 62779] Paragraph text search results start with an error marker.

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

PJ Fanning <fa...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from PJ Fanning <fa...@yahoo.com> ---
Would you be able to provide a test case? Something that reads an input docx
and that does a searchText call that fails with existing code but that passes
with your change.

A few existing tests can be found in:

https://github.com/apache/poi/blob/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFParagraph.java

-- 
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 62779] Paragraph text search results start with an error marker.

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

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