summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2006-09-07 23:33:58 (EDT)
committerpelder2006-09-07 23:33:58 (EDT)
commitc959c34d5fcd9e14a73b9ed2d4a7b16986562e41 (patch)
treeb0845f311ad636b03e2555e56d6575a1f1bf199e
parent4b45eb7aed17c94b7f4b516b24fa5641b223974e (diff)
downloadorg.eclipse.jet-c959c34d5fcd9e14a73b9ed2d4a7b16986562e41.zip
org.eclipse.jet-c959c34d5fcd9e14a73b9ed2d4a7b16986562e41.tar.gz
org.eclipse.jet-c959c34d5fcd9e14a73b9ed2d4a7b16986562e41.tar.bz2
[156637] Raise an error when a trailing segment of an XPath expression is not recognized.
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/XPathImpl.java8
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/parser/XPathParser.java2
2 files changed, 9 insertions, 1 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/XPathImpl.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/XPathImpl.java
index 83e58f4..3e88803 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/XPathImpl.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/XPathImpl.java
@@ -17,8 +17,12 @@
package org.eclipse.jet.internal.xpath;
+import java.text.MessageFormat;
+
+import org.eclipse.jet.internal.l10n.JET2Messages;
import org.eclipse.jet.internal.xpath.ast.ExprNode;
import org.eclipse.jet.internal.xpath.functions.BuiltinXPathFunctionResolver;
+import org.eclipse.jet.internal.xpath.parser.Token;
import org.eclipse.jet.internal.xpath.parser.XPathParser;
import org.eclipse.jet.xpath.IAnnotationManager;
import org.eclipse.jet.xpath.NamespaceContext;
@@ -26,6 +30,7 @@ import org.eclipse.jet.xpath.XPath;
import org.eclipse.jet.xpath.XPathException;
import org.eclipse.jet.xpath.XPathExpression;
import org.eclipse.jet.xpath.XPathFunctionResolver;
+import org.eclipse.jet.xpath.XPathSyntaxException;
import org.eclipse.jet.xpath.XPathVariableResolver;
@@ -96,6 +101,9 @@ public class XPathImpl implements XPath
ExprNode expr = parser.expr();
// FIXME verify that the parser is at the end of its input.
// FIXME Do a semantic analysis of expr to detect semantic errors not found in parsing.
+ if(parser.peekNext() != Token.EOF_TOKEN) {
+ throw new XPathSyntaxException(MessageFormat.format(JET2Messages.XPath_UnrecognizedToken, new Object[] {parser.peekNext()}));
+ }
XPathExpressionImpl pathExpr = new XPathExpressionImpl(expr, variableResolver, annotationManager);
return pathExpr;
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/parser/XPathParser.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/parser/XPathParser.java
index ba7ea53..f488eee 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/parser/XPathParser.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/parser/XPathParser.java
@@ -669,7 +669,7 @@ public class XPathParser
return ti.getTokenText(input);
}
- private Token peekNext()
+ public Token peekNext()
{
return peek(1);
}