Bug 47287

Summary: StringIndexOutOfBoundsException in CharacterRun.replaceText()
Product: POI Reporter: Eugene Torkhov <e.torkhov>
Component: HWPFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 3.2-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Attachments: Java code

Description Eugene Torkhov 2009-05-29 15:02:41 UTC
Created attachment 23730 [details]
Java code

Sometime, replaceText() issue exception while delete() and insert() does not.
So next code is workaround:

try {
  run.replaceText(oldText, text, 0);
}
catch (StringIndexOutOfBoundsException e) {
  //e.printStackTrace(System.err);
  run.delete();
  run.insertBefore(text);
}


You are can try it on attachment in Bug 47286.
Comment 1 Yegor Kozlov 2011-06-24 08:22:07 UTC
The problem is still reproducible with trunk. 

Yegor
Comment 2 Sergey Vladimirov 2011-07-07 12:12:41 UTC
Fixed in r1143774; shall be part of poi 3.8-beta4