santiagopg    2002/12/05 06:30:20

  Modified:    java/src/org/apache/xalan/xsltc/dom DOMImpl.java
  Log:
   Patch for Bugzilla 15094. Fixed method to compute limit in a Descendant
  iterator; old method was (very) buggy.
  
  Revision  Changes    Path
  1.89      +10 -17    
xml-xalan/java/src/org/apache/xalan/xsltc/dom/DOMImpl.java
  
  Index: DOMImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/DOMImpl.java,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -r1.88 -r1.89
  --- DOMImpl.java      29 Oct 2002 17:26:20 -0000      1.88
  +++ DOMImpl.java      5 Dec 2002 14:30:19 -0000       1.89
  @@ -1524,13 +1524,17 @@
                    // set _limit to match next()'s criteria for end
                    _limit = node + 1;
                }
  -             // find leftmost descendant of next sibling
  -             else if ((node = _nextSibling[node]) == 0) {
  -                 // no next sibling, array end is the limit
  -                 _limit = _treeNodeLimit;
  +             else if ((_limit = _nextSibling[node]) == 0) {
  +                 final int parent = _parent[node];
  +                 if (parent == 0 || (_limit = _nextSibling[parent]) == 0) {
  +                     _limit = _treeNodeLimit;
  +                 }
  +                 else {
  +                     // _limit already set to parent's next sibling.
  +                 }
                }
                else {
  -                 _limit = leftmostDescendant(node);
  +                 // _limit already set to next sibling.
                }
                return resetPosition();
            }
  @@ -1877,17 +1881,6 @@
        */
       public NodeIterator orderNodes(NodeIterator source, int node) {
        return new DupFilterIterator(source);
  -    }
  -
  -    /**
  -     * Returns the leftmost descendant of a node (bottom left in sub-tree)
  -     */
  -    private int leftmostDescendant(int node) {
  -     int current;
  -     while (_type[current = node] >= NTYPES 
  -            && (node = _offsetOrChild[node]) != NULL) {
  -     }
  -     return current;
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to