From: jhugunin Date: Wed, 5 Mar 2003 19:33:20 +0000 (+0000) Subject: added a range check to avoid ArrayIndexOutOfBounds X-Git-Tag: v1_1_0_RC1~66 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fc75595cee1292e5e86d741e9301648b74aa3c79;p=aspectj.git 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 --- 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;