From fc75595cee1292e5e86d741e9301648b74aa3c79 Mon Sep 17 00:00:00 2001 From: jhugunin Date: Wed, 5 Mar 2003 19:33:20 +0000 Subject: [PATCH] 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 --- .../ajdt/internal/compiler/lookup/EclipseSourceLocation.java | 5 +++-- 1 file 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; -- 2.39.5