Author: bbrodt
Date: 2010-03-05 10:13:37 -0500 (Fri, 05 Mar 2010)
New Revision: 20688
Modified:
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/xpath/XPathValidator.java
Log:
JBIDE-5999: BPEL Editor XPath validator does not recognize return types of XPath
functions
Modified:
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/xpath/XPathValidator.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/xpath/XPathValidator.java 2010-03-05
14:53:55 UTC (rev 20687)
+++
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/xpath/XPathValidator.java 2010-03-05
15:13:37 UTC (rev 20688)
@@ -407,28 +407,37 @@
mVisitor.visit((EqualityExpr) expr);
} else if (expr instanceof RelationalExpr) {
mVisitor.visit((RelationalExpr) expr);
- } else if (expr instanceof FunctionCallExpr) {
- FunctionCallExpr fce = (FunctionCallExpr) expr;
-
- if (isBooleanFunction(fce) == false) {
-
- problem = createWarning();
- problem.fill("XPATH_EXPRESSION_TYPE", toString(mNode.nodeName()),
- exprStringTrimmed, fExprByNode);
- repointOffsets(problem, fce);
+ } else {
+ FunctionCallExpr fce = null;
+ // JBIDE-5999
+ // apparently XPath functions are Unary expressions first
+ if (expr instanceof UnaryExpr && ((UnaryExpr)expr).getExpr() instanceof
FunctionCallExpr) {
+ fce = (FunctionCallExpr) ((UnaryExpr)expr).getExpr();
+ } else if (expr instanceof FunctionCallExpr) {
+ fce = (FunctionCallExpr) expr;
}
-
- mVisitor.visit(fce);
-
- } else {
- problem = createError();
- problem.fill("XPATH_EXPRESSION_TYPE", toString(mNode.nodeName()),
exprStringTrimmed,
- fExprByNode
-
- );
- repointOffsets(problem, expr);
+
+ if (fce!=null ) {
+ if (isBooleanFunction(fce) == false) {
+
+ problem = createWarning();
+ problem.fill("XPATH_EXPRESSION_TYPE", toString(mNode.nodeName()),
+ exprStringTrimmed, fExprByNode);
+ repointOffsets(problem, fce);
+ }
+
+ mVisitor.visit(fce);
+
+ } else {
+ problem = createError();
+ problem.fill("XPATH_EXPRESSION_TYPE", toString(mNode.nodeName()),
exprStringTrimmed,
+ fExprByNode
+
+ );
+ repointOffsets(problem, expr);
+ }
}
-
+
// Once validated this type of expression we are done.
disableRules();