Author: karthick
Date: Wed Aug 19 21:49:24 2009
New Revision: 805989

URL: http://svn.apache.org/viewvc?rev=805989&view=rev
Log:
ODE-651 Handle edge case while compiling variables in while conditions.

Modified:
    
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/XPath20ExpressionCompilerImpl.java

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=805989&r1=805988&r2=805989&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
 Wed Aug 19 21:49:24 2009
@@ -194,11 +194,11 @@
                int firstVariable = xpathStr.indexOf("$"), 
                        lastVariable = xpathStr.lastIndexOf("$"),
                        firstFunction = xpathStr.indexOf("("); 
+               StringBuffer variableExpr = new StringBuffer();
                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;
                        Name11Checker nameChecker = Name11Checker.getInstance();
                        for (int index = 0; index < xpathStr.length(); index++) 
{
@@ -228,10 +228,14 @@
                                                        variable = false;
                                                        
variableExpr.setLength(variableExpr.length() - 1);
                                                        
variableExprs.add(variableExpr.toString());
+                                                       
variableExpr.setLength(0);
                                                }
                                        }
                                }
                        }
+                       if (variableExpr.length() > 0) {
+                               variableExprs.add(variableExpr.toString());
+                       }
                }
                return variableExprs;
        }


Reply via email to