You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by ka...@apache.org on 2009/01/24 00:14:05 UTC

svn commit: r737243 - in /ode/branches/APACHE_ODE_1.X: bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/XPath20ExpressionCompilerImpl.java bpel-test/src/test/resources/bpel/2.0/TestAssignActivity2/TestAssign.bpel

Author: karthick
Date: Fri Jan 23 23:14:05 2009
New Revision: 737243

URL: http://svn.apache.org/viewvc?rev=737243&view=rev
Log:
ODE-498 Make sure to evaluate all variable references, no matter how many there are.

Modified:
    ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/XPath20ExpressionCompilerImpl.java
    ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity2/TestAssign.bpel

Modified: ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/XPath20ExpressionCompilerImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/XPath20ExpressionCompilerImpl.java?rev=737243&r1=737242&r2=737243&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/XPath20ExpressionCompilerImpl.java (original)
+++ ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/XPath20ExpressionCompilerImpl.java Fri Jan 23 23:14:05 2009
@@ -191,8 +191,12 @@
      */
     private List<String> extractVariableExprs(String xpathStr) {    	
 		ArrayList<String> variableExprs = new ArrayList<String>();
-		if (xpathStr.indexOf("$") > 0 && // the xpath references a variable
-				xpathStr.indexOf("(") > 0) { // the xpath contains a function
+		int firstVariable = xpathStr.indexOf("$"), 
+			lastVariable = xpathStr.lastIndexOf("$"),
+			firstFunction = xpathStr.indexOf("("); 
+		if ((firstVariable > 0 && // the xpath references a variable
+				firstFunction > 0) || // the xpath contains a function
+			(firstVariable < lastVariable)) { // the xpath references multiple variables  
 			// most likely, the variable reference has not been resolved, so make that happen
 			StringBuffer variableExpr = new StringBuffer();
 			boolean quoted = false, doubleQuoted = false, variable = false;

Modified: ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity2/TestAssign.bpel
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity2/TestAssign.bpel?rev=737243&r1=737242&r2=737243&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity2/TestAssign.bpel (original)
+++ ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity2/TestAssign.bpel Fri Jan 23 23:14:05 2009
@@ -44,6 +44,7 @@
         <variable name="otherMsgVar" messageType="test:TestAssignMessage"/>
         <variable name="strVar" type="xsd:string"/>
         <variable name="txtVar" type="xsd:string"/>
+        <variable name="eprVar" type="xsd:anyType"/>
         <variable name="intVar" type="xsd:int"/>
     </variables>
 
@@ -89,7 +90,11 @@
                 <to variable="strVar"/>
             </copy>
             <copy>
-                <from>ode:process-property("dd:epr")/addr:EndpointReference/child::node()[$intVar]</from>
+                <from>ode:process-property("dd:epr")/addr:EndpointReference</from>
+                <to>$eprVar</to>
+            </copy>
+            <copy>
+                <from>$eprVar/child::node()[$intVar]</from>
                 <to variable="strVar"/>
             </copy>
         </assign>