Author: asmuts
Date: Tue Jun 20 07:00:48 2006
New Revision: 415643
URL: http://svn.apache.org/viewvc?rev=415643&view=rev
Log:
Fixed index out of bounds exception in SortedPreferentialArray. Changed
original loop fix to use System.arraycopy.
Added:
jakarta/jcs/trunk/tempbuild/jcs-1.2.7.7.jar (with props)
Modified:
jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/SortedPreferentialArray.java
jakarta/jcs/trunk/xdocs/changes.xml
Modified:
jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/SortedPreferentialArray.java
URL:
http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/SortedPreferentialArray.java?rev=415643&r1=415642&r2=415643&view=diff
==============================================================================
---
jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/SortedPreferentialArray.java
(original)
+++
jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/SortedPreferentialArray.java
Tue Jun 20 07:00:48 2006
@@ -567,28 +567,19 @@
{
throw new IndexOutOfBoundsException( "position=" + position + "
must be less than curSize=" + curSize );
}
- //curSize--;
+ curSize--;
if ( position < curSize )
{
try
{
- // this didn't work, I'm leaving it here for now.
- //System.arraycopy( array, position + 1, array, position,
curSize );
-
- // suffle left from removal point
- int end = curSize - 1;
- for (int i = position; i < end; i++)
- {
- array[i] = array[i + 1];
- }
- curSize--;
+ System.arraycopy( array, position + 1, array, position, (
curSize - position ) );
}
catch ( IndexOutOfBoundsException ibe )
{
- // throw this, log details for debugging. This shouldn't
happen.
+ // throw this, log details for debugging. This shouldn't
happen.
log.warn( "Caught index out of bounds exception. "
- + "called 'System.arraycopy( array, position + 1, array,
position, curSize );' "
+ + "called 'System.arraycopy( array, position + 1, array,
position, (curSize - position) );' "
+ "array.lengh [" + array.length + "] position [" +
position + "] curSize [" + curSize + "]" );
throw ibe;
}
Added: jakarta/jcs/trunk/tempbuild/jcs-1.2.7.7.jar
URL:
http://svn.apache.org/viewvc/jakarta/jcs/trunk/tempbuild/jcs-1.2.7.7.jar?rev=415643&view=auto
==============================================================================
Binary file - no diff available.
Propchange: jakarta/jcs/trunk/tempbuild/jcs-1.2.7.7.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: jakarta/jcs/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/jakarta/jcs/trunk/xdocs/changes.xml?rev=415643&r1=415642&r2=415643&view=diff
==============================================================================
--- jakarta/jcs/trunk/xdocs/changes.xml (original)
+++ jakarta/jcs/trunk/xdocs/changes.xml Tue Jun 20 07:00:48 2006
@@ -6,7 +6,8 @@
<body>
<release version="1.2.7.7" date="in CVS">
- <action dev="asmuts" type="fix">
+ <action dev="asmuts" type="fix"
+ due-to="Brian Crow @noteworthyms.com">
Fixed the array index out of bounds exception
in the Sorted
Preferential Array.
</action>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]