diff --git a/src/gov/nist/core/StringTokenizer.java b/src/gov/nist/core/StringTokenizer.java index 2b8067054..7849e1fea 100755 --- a/src/gov/nist/core/StringTokenizer.java +++ b/src/gov/nist/core/StringTokenizer.java @@ -134,12 +134,8 @@ public char lookAhead() throws ParseException { public char lookAhead(int k) throws ParseException { // Debug.out.println("ptr = " + ptr); - try { - return buffer[ptr + k]; - } - catch (IndexOutOfBoundsException e) { - return '\0'; - } + int index = ptr + k; + return index < buffer.length ? buffer[index] : '\0'; } public char getNextChar() throws ParseException {