Bug 47287 - StringIndexOutOfBoundsException in CharacterRun.replaceText()
Summary: StringIndexOutOfBoundsException in CharacterRun.replaceText()
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HWPF (show other bugs)
Version: 3.2-FINAL
Hardware: PC Windows XP
: P2 normal with 1 vote (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-29 15:02 UTC by Eugene Torkhov
Modified: 2011-07-07 12:12 UTC (History)
0 users



Attachments
Java code (2.63 KB, text/plain)
2009-05-29 15:02 UTC, Eugene Torkhov
Details

Note You need to log in before you can comment on or make changes to this bug.
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