sboag       00/12/16 22:18:19

  Modified:    java/src/org/apache/xpath/axes FilterExprWalker.java
  Log:
  Set the variable context in setRoot, since it may be executed during
  a cloneWithReset operation, in which case the variable context
  is not set by LocPathIterator's nextNode.  This bug was uncovered
  by fixing the deep clone operation, at which point the filter walker
  may not have been cloned.
  
  Revision  Changes    Path
  1.11      +17 -0     
xml-xalan/java/src/org/apache/xpath/axes/FilterExprWalker.java
  
  Index: FilterExprWalker.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/axes/FilterExprWalker.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- FilterExprWalker.java     2000/12/16 17:16:25     1.10
  +++ FilterExprWalker.java     2000/12/17 06:18:19     1.11
  @@ -60,6 +60,7 @@
   import org.apache.xpath.XPath;
   import org.apache.xpath.Expression;
   import org.apache.xpath.XPathContext;
  +import org.apache.xpath.VariableStack;
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.DOMHelper;
   import org.apache.xml.utils.PrefixResolver;
  @@ -137,9 +138,25 @@
       {
         xctxt.pushCurrentNode(root);
         xctxt.setNamespaceContext(m_lpi.getPrefixResolver());
  +      
  +      // The setRoot operation can take place with a reset operation, 
  +      // and so we may not be in the context of LocPathIterator#nextNode, 
  +      // so we have to set up the variable context, execute the expression, 
  +      // and then restore the variable context.
   
         // System.out.println("calling 
m_expr.execute(m_lpi.getXPathContext())");
  +      VariableStack vars = m_lpi.m_execContext.getVarStack();
  +      
  +      // These three statements need to be combined into one operation.
  +      int savedStart = vars.getSearchStart();
  +      vars.setSearchStart(m_lpi.m_varStackPos);
  +      vars.pushContextPosition(m_lpi.m_varStackContext);
  +      
         XObject obj = m_expr.execute(m_lpi.getXPathContext());
  +      
  +      // These two statements need to be combined into one operation.
  +      vars.setSearchStart(savedStart);
  +      vars.popContextPosition();
         
         // System.out.println("Back from 
m_expr.execute(m_lpi.getXPathContext()): "+obj);
         m_nodeSet = (null != obj) ? obj.nodeset() : null;
  
  
  

Reply via email to