aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authorjhugunin <jhugunin>2003-03-05 19:33:20 +0000
committerjhugunin <jhugunin>2003-03-05 19:33:20 +0000
commitfc75595cee1292e5e86d741e9301648b74aa3c79 (patch)
tree655714d7c64de11b4cdebcb54912ffefeaed3c55 /org.aspectj.ajdt.core
parent6e88a58b2cb671f2a1ea1dcc4534586362e324dc (diff)
downloadaspectj-fc75595cee1292e5e86d741e9301648b74aa3c79.tar.gz
aspectj-fc75595cee1292e5e86d741e9301648b74aa3c79.zip
added a range check to avoid ArrayIndexOutOfBounds
-- this bug was found by the unit tests and should have been fixed when this method was added
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java
index d245cb90f..3f9170237 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java
@@ -57,8 +57,9 @@ public class EclipseSourceLocation implements ISourceLocation {
public int getColumn() {
if (-1 == column) {
int lineNumber = getLine();
- if (0 < lineNumber) {
- int lineStart = result.lineSeparatorPositions[getLine()];
+ // JJH added check that lineNumber is in legal range to avoid exceptions
+ if (0 < lineNumber && lineNumber < result.lineSeparatorPositions.length) {
+ int lineStart = result.lineSeparatorPositions[lineNumber];
int col = startPos - lineStart; // 1-based
if (0 <= col) {
column = col;