You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by mt...@apache.org on 2006/10/11 01:30:52 UTC

svn commit: r462657 - /incubator/xap/trunk/src/xap/util/Vector.js

Author: mturyn
Date: Tue Oct 10 18:30:51 2006
New Revision: 462657

URL: http://svn.apache.org/viewvc?view=rev&rev=462657
Log:
insertElementAt() had slightly wrong boundary conditions, probably copied from a removal method.

Modified:
    incubator/xap/trunk/src/xap/util/Vector.js

Modified: incubator/xap/trunk/src/xap/util/Vector.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/util/Vector.js?view=diff&rev=462657&r1=462656&r2=462657
==============================================================================
--- incubator/xap/trunk/src/xap/util/Vector.js (original)
+++ incubator/xap/trunk/src/xap/util/Vector.js Tue Oct 10 18:30:51 2006
@@ -73,7 +73,12 @@
 }
 
 xap.util.Vector.prototype.insertElementAt = function( obj, index ) {
-	if ( index < 0 || index >= this._size ) {
+	// From the Vector javadoc:
+	// The index must be a value greater than or equal to 0 and 
+	// less than or equal to the current size of the vector. 
+	// (If the index is equal to the current size of the vector,
+	// the new element is appended to the Vector.)
+	if ( index < 0 || index > this._size ) {
 		throw "IndexOutOfBoundsException in insertElementAt:" + index ;
 	}
 	if ( this._size == this._capacity ) {