Updated Branches:
  refs/heads/ode-1.3.6.x 0e2df88f2 -> 0a2e6f97c

Logging for selectionFailure faults improved.


Project: http://git-wip-us.apache.org/repos/asf/ode/repo
Commit: http://git-wip-us.apache.org/repos/asf/ode/commit/0e0b40b7
Tree: http://git-wip-us.apache.org/repos/asf/ode/tree/0e0b40b7
Diff: http://git-wip-us.apache.org/repos/asf/ode/diff/0e0b40b7

Branch: refs/heads/ode-1.3.6.x
Commit: 0e0b40b7fe6dd483d399d9fb31de2ffda8709b1a
Parents: 0e2df88
Author: Tammo van Lessen <[email protected]>
Authored: Tue Jul 6 22:56:07 2010 +0000
Committer: Tammo van Lessen <[email protected]>
Committed: Tue Oct 1 00:45:58 2013 +0200

----------------------------------------------------------------------
 .../runtime/XPath10ExpressionRuntime.java       | 21 +++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ode/blob/0e0b40b7/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath10/runtime/XPath10ExpressionRuntime.java
----------------------------------------------------------------------
diff --git 
a/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath10/runtime/XPath10ExpressionRuntime.java
 
b/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath10/runtime/XPath10ExpressionRuntime.java
index 3580393..d8986f1 100644
--- 
a/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath10/runtime/XPath10ExpressionRuntime.java
+++ 
b/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath10/runtime/XPath10ExpressionRuntime.java
@@ -133,11 +133,22 @@ public class XPath10ExpressionRuntime implements 
ExpressionLanguageRuntime {
 
     public Node evaluateNode(OExpression cexp, EvaluationContext ctx) throws 
FaultException, EvaluationException {
         List retVal = evaluate(cexp, ctx);
-        if (retVal.size() == 0)
-            throw new 
FaultException(cexp.getOwner().constants.qnSelectionFailure, "No results for 
expression: " + cexp);
-        if (retVal.size() > 1)
-            throw new 
FaultException(cexp.getOwner().constants.qnSelectionFailure, "Multiple results 
for expression: "
-                    + cexp);
+        if (retVal.size() == 0 || retVal.size() > 1) {
+            StringBuffer msg = new StringBuffer((retVal.size() == 0) ? "No 
results for expression: '" : "Multiple results for expression: '");
+            if (cexp instanceof OXPath10Expression) {
+                msg.append(((OXPath10Expression)cexp).xpath);
+            } else {
+                msg.append(cexp.toString());                
+            }
+            msg.append("'");
+            if (ctx.getRootNode() != null) {
+                msg.append(" against '");
+                msg.append(DOMUtils.domToString(ctx.getRootNode()));
+                msg.append("'");
+            }
+            throw new 
FaultException(cexp.getOwner().constants.qnSelectionFailure, msg.toString());
+        }
+            
         return (Node) retVal.get(0);
     }
 

Reply via email to