xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grc...@apache.org
Subject cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/dom UnionIterator.java
Date Thu, 26 Jun 2003 22:08:42 GMT
grchiu      2003/06/26 15:08:41

  Modified:    java/src/org/apache/xalan/xsltc/dom UnionIterator.java
  Log:
  Patch from Christine Li (jycli@ca.ibm.com) for bugzilla 20913, with
  modifications. In UnionIterator, after calling the getLast() method, the
  heap is not restored properly. Recreate the heap in gotoMark(), as well
  as restore _returnedLast and _heapSize.
  
  Revision  Changes    Path
  1.16      +16 -1     xml-xalan/java/src/org/apache/xalan/xsltc/dom/UnionIterator.java
  
  Index: UnionIterator.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/UnionIterator.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- UnionIterator.java	1 Apr 2003 21:39:17 -0000	1.15
  +++ UnionIterator.java	26 Jun 2003 22:08:41 -0000	1.16
  @@ -124,6 +124,11 @@
       // used to prune duplicates
       private int _returnedLast;
   
  +    // cached returned last for use in gotoMark
  +    private int _cachedReturnedLast = END;
  +    // cached heap size for use in gotoMark
  +    private int _cachedHeapSize;
  +
       public UnionIterator(DOM dom) {
   	_dom = dom;
       }
  @@ -205,6 +210,9 @@
   	return this;
       }
   	
  +    /* Build a heap in document order. put the smallest node on the top. 
  +     * "smallest node" means the node before other nodes in document order
  +     */
       private void heapify(int i) {
   	for (int r, l, smallest;;) {
   	    r = (i + 1) << 1; l = r - 1;
  @@ -229,12 +237,19 @@
   	for (int i = 0; i < _free; i++) {
   	    _heap[i].setMark();
   	}
  +	_cachedReturnedLast = _returnedLast;    
  +	_cachedHeapSize = _heapSize;
       }
   
       public void gotoMark() {
   	for (int i = 0; i < _free; i++) {
   	    _heap[i].gotoMark();
   	}
  +	// rebuild heap after call last() function. fix for bug 20913
  +	for (int i = (_heapSize = _cachedHeapSize)/2; i >= 0; i--) {
  +	    heapify(i);
  +	}
  +    _returnedLast = _cachedReturnedLast;    
       }
   
       public DTMAxisIterator reset() {
  
  
  

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


Mime
View raw message