summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2006-07-31 13:28:44 (EDT)
committerpelder2006-07-31 13:28:44 (EDT)
commit0a56e57ddb7e15cb46ea567f381edf36a13f02f2 (patch)
tree65788168da09a3269b22b378566e8e9b22b5b09e
parente3771612fe41efc4fac8b720437a283ac2aca7be (diff)
downloadorg.eclipse.jet-0a56e57ddb7e15cb46ea567f381edf36a13f02f2.zip
org.eclipse.jet-0a56e57ddb7e15cb46ea567f381edf36a13f02f2.tar.gz
org.eclipse.jet-0a56e57ddb7e15cb46ea567f381edf36a13f02f2.tar.bz2
[152353] Replace after-the-fact checks for IndexOutOfBoundsException with defensive checks of index against string length.
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/parser/XPathTokenScanner.java15
1 files changed, 2 insertions, 13 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/parser/XPathTokenScanner.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/parser/XPathTokenScanner.java
index c65bfd4..0925a4a 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/parser/XPathTokenScanner.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/parser/XPathTokenScanner.java
@@ -297,19 +297,8 @@ public class XPathTokenScanner
public int next()
{
- int next = EOF;
- try
- {
- next = input.charAt(nextOffset);
- }
- catch (IndexOutOfBoundsException e)
- {
- // do nothing
- }
- finally
- {
- ++nextOffset;
- }
+ int next = nextOffset < input.length() ? input.charAt(nextOffset) : EOF;
+ ++nextOffset;
return next;
}