diff options
author | Andrey Loskutov | 2018-03-16 22:46:12 +0000 |
---|---|---|
committer | Andrey Loskutov | 2018-03-16 22:46:12 +0000 |
commit | 2845642ec596b6f74374b75e13234030803818fb (patch) | |
tree | 3c9af30cee27849e4ca9dae34168517a18777c3c | |
parent | 5e9451f731437c846f40d7bc2638205aa362f1e9 (diff) | |
download | eclipse.platform.text-2845642ec596b6f74374b75e13234030803818fb.tar.gz eclipse.platform.text-2845642ec596b6f74374b75e13234030803818fb.tar.xz eclipse.platform.text-2845642ec596b6f74374b75e13234030803818fb.zip |
Bug 532557 - add line information to BadLocationExceptionI20180317-1500
Change-Id: I74a18b81fe55d44e199578d481bfcc113a8db7a6
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r-- | org.eclipse.text/src/org/eclipse/jface/text/ListLineTracker.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/ListLineTracker.java b/org.eclipse.text/src/org/eclipse/jface/text/ListLineTracker.java index 299e9c647d6..d8e12d815e1 100644 --- a/org.eclipse.text/src/org/eclipse/jface/text/ListLineTracker.java +++ b/org.eclipse.text/src/org/eclipse/jface/text/ListLineTracker.java @@ -132,8 +132,11 @@ abstract class ListLineTracker implements ILineTracker { @Override public final int getLineNumberOfOffset(int position) throws BadLocationException { - if (position < 0 || position > fTextLength) - throw new BadLocationException(); + if (position < 0) { + throw new BadLocationException("Negative offset : " + position); //$NON-NLS-1$ + } else if (position > fTextLength) { + throw new BadLocationException("Offset > length: " + position + " > " + fTextLength); //$NON-NLS-1$//$NON-NLS-2$ + } if (position == fTextLength) { @@ -151,7 +154,7 @@ abstract class ListLineTracker implements ILineTracker { @Override public final IRegion getLineInformationOfOffset(int position) throws BadLocationException { if (position > fTextLength) - throw new BadLocationException(); + throw new BadLocationException("Offset > length: " + position + " > " + fTextLength); //$NON-NLS-1$//$NON-NLS-2$ if (position == fTextLength) { int size= fLines.size(); |