You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2003/07/12 20:35:00 UTC

DO NOT REPLY [Bug 21537] New: - XSLTC ArrayIndexOutOfBounds during StepIterator clone

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21537>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21537

XSLTC ArrayIndexOutOfBounds during StepIterator clone

           Summary: XSLTC ArrayIndexOutOfBounds during StepIterator clone
           Product: XalanJ2
           Version: 2.5Dx
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan.xsltc
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: Alex.Lesniak@mdx.com


After consistent TransformerExceptions from XSLTC, changed error reporting and 
traced the issue down to an ArrayIndexOutOfBounds exception in 
xsltc.utils.IntegerArray during a StepIterator.clone().  This happens when the 
requested size of the IntegerArray being cloned is 0, and IntegerArray.add
(int) is subsequently called.

The problem is in the following from IntegerArray:

    private void growArray(int size) {
	// Should test for size = 0
        // Maybe:
        // 
        // if (size == 0)
        //   size++
        //
        final int[] newArray = new int[_size = size];
	System.arraycopy(_array, 0, newArray, 0, _free);
	_array = newArray;
    }

The exception is thrown by the following:

    public final void add(int value) {
        // Doesn't work for _size = 0
	if (_free == _size) {
	    growArray(_size * 2);
	}
        // Array with 0 elements throws ArrayIndexOutOfBounds
	_array[_free++] = value;
    }

Thanks,

-- APL