You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by jk...@apache.org on 2002/05/17 01:38:41 UTC

cvs commit: xml-xalan/java/src/org/apache/xml/dtm/ref DTMDefaultBase.java DTMDefaultBaseIterators.java

jkesselm    02/05/16 16:38:41

  Modified:    java/src/org/apache/xml/dtm/ref DTMDefaultBase.java
                        DTMDefaultBaseIterators.java
  Log:
  Fix for new tests Variable71 and Variable72.
  
  When we went to the shared RTF DTMs, we forgot to update
  PreceedingIterator to reflect the fact that the root of a DTM tree
  may no longer have 0 as its internal Node Identifier. This change
  corrects that situation, and does so without imposing a lot of
  computational overhead since we need to scan the ancestors
  anyway.
  
  There appear to be similar hazards in some of the Traversers,
  still to be dealt with. Coming up with testcases which will provoke
  those bugs (and confirm that we've fixed them) is likely to be
  harder than writing the fix itself...
  
  Revision  Changes    Path
  1.29      +0 -3      xml-xalan/java/src/org/apache/xml/dtm/ref/DTMDefaultBase.java
  
  Index: DTMDefaultBase.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/DTMDefaultBase.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- DTMDefaultBase.java	10 Apr 2002 20:33:16 -0000	1.28
  +++ DTMDefaultBase.java	16 May 2002 23:38:41 -0000	1.29
  @@ -176,9 +176,6 @@
     /** The XMLString factory for creating XMLStrings. */
     protected XMLStringFactory m_xstrf;
   
  -  /** The identity of the root node. */
  -  public static final int ROOTNODE = 0;
  -
     /**
      * The table for exandedNameID lookups.  This may or may not be the same
      * table as is contained in the DTMManagerDefault.
  
  
  
  1.14      +16 -18    xml-xalan/java/src/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java
  
  Index: DTMDefaultBaseIterators.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- DTMDefaultBaseIterators.java	16 May 2002 17:06:06 -0000	1.13
  +++ DTMDefaultBaseIterators.java	16 May 2002 23:38:41 -0000	1.14
  @@ -1036,7 +1036,7 @@
             return resetPosition();
           }
             
  -        int type = m_expandedNameTable.getType(getExpandedTypeID(node)); 
  +        int type = m_expandedNameTable.getType(getExpandedTypeID(node));
           if(ExpandedNameTable.ATTRIBUTE == type 
              || ExpandedNameTable.NAMESPACE == type )
           {
  @@ -1131,7 +1131,7 @@
       private final int _maxAncestors = 8;
   
       /**
  -     * The stack of start node + ancestors up to ROOTNODE,
  +     * The stack of start node + ancestors up to the root of the tree,
        *  which we must avoid.
        */
       private int[] _stack = new int[_maxAncestors];
  @@ -1196,25 +1196,23 @@
           int parent, index;
   
           _startNode = node;
  -        _currentNode = ROOTNODE;  // Remember it's the identity, not the full handle.
           _stack[index = 0] = node;
   
  -        if (node > ROOTNODE)
  -        {
  -          while ((parent = _parent(node)) != ROOTNODE)
  -          {
  -            if (++index == _stack.length)
  -            {
  -              final int[] stack = new int[index + 4];
  -
  -              System.arraycopy(_stack, 0, stack, 0, index);
  -
  -              _stack = stack;
  -            }
  -
  -            _stack[index] = node = parent;
  -          }
  +		parent=node;
  +		while ((parent = _parent(parent)) != NULL)
  +		{
  +			if (++index == _stack.length)
  +			{
  +				final int[] stack = new int[index + 4];
  +				System.arraycopy(_stack, 0, stack, 0, index);
  +				_stack = stack;
  +			}
  +			_stack[index] = parent;
           }
  +        if(index>0)
  +	        --index; // Pop actual root node (if not start) back off the stack
  +
  +        _currentNode=_stack[index]; // Last parent before root node
   
           _oldsp = _sp = index;
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org