Bug 62412

Summary: XWPFParagraph.searchText returns null although the paragraph contains the searched value
Product: POI Reporter: Florian Sommer <sommer.florian>
Component: XWPFAssignee: POI Developers List <dev>
Status: NEW ---    
Severity: normal    
Priority: P2    
Version: 3.17-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Florian Sommer 2018-05-27 10:40:40 UTC
The current Implementation of XWPFParagraph.searchText(...) is basically a buggy version of the KMP Algorithm to search text

Searched = "yoyoPlayer"
Text = "yoyoyoPlayer"
Result = null, expected = found at beginChar=2

The testcase, a lengthy explanation of the bug's cause and the fix are provided in this repo:


Go to test class 'YoyoPlayerTest' (test folder).
The fix is provided in class 'FixedParagraphSearchText' (main folder)

Note: In a second test case I also demonstrate the bug 57727, which is also fixed in the FixedParagraphSearchText class. Sorry for the mess