Add message to IndexOutOfBoundsException in InternalNodeModelUtils ()

Signed-off-by: Titouan Vervack <titouan.vervack@sigasi.com>
This commit is contained in:
Titouan Vervack 2020-07-15 00:37:33 +02:00 committed by GitHub
parent d6a96a8960
commit a797694299
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,6 +15,7 @@ import java.util.List;
import org.eclipse.xtext.nodemodel.INode;
import org.eclipse.xtext.util.LineAndColumn;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
/**
@ -57,9 +58,8 @@ public class InternalNodeModelUtils {
* that point to the very first char in each line.
*/
protected static LineAndColumn getLineAndColumn(String text, int[] lineBreaks, int offset) {
if (offset > text.length() || offset < 0) {
throw new IndexOutOfBoundsException();
}
Preconditions.checkPositionIndex(offset, text.length());
int idx = Arrays.binarySearch(lineBreaks, offset);
if (idx >= 0) {
/*