BreakIterator.isBoundary(int offset) throws IllegalArgumentException in case when
offset is out of bounds of the text.
Please find below the sample for the issue:
----------------------------------------------------------------
String text = "hello world";
int values[] = {-100, -1, text.length() + 1, 100};
BreakIterator iter = BreakIterator.getWordInstance();
iter.setText("hello world");
for (int offset : values) {
try {
iter.isBoundary(offset);
System.out.println("not thrown for offset: " + offset);
} catch (IllegalArgumentException ex) {
}
}
----------------------------------------------------------------