Author: manik.surtani(a)jboss.com
Date: 2008-07-29 06:16:53 -0400 (Tue, 29 Jul 2008)
New Revision: 6418
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/util/ImmutableListCopy.java
Log:
Fixed bug in range check
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/util/ImmutableListCopy.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/util/ImmutableListCopy.java 2008-07-28
18:42:56 UTC (rev 6417)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/util/ImmutableListCopy.java 2008-07-29
10:16:53 UTC (rev 6418)
@@ -313,15 +313,10 @@
@SuppressWarnings("unchecked")
public final E get(int index)
{
- rangeCheck(index);
+ if (index < 0 || index >= size) throw new
IndexOutOfBoundsException("Index: " + index + ", Size: " + size);
return (E) ImmutableListCopy.this.get(index + offset);
}
- private void rangeCheck(int index)
- {
- if (index < 0 || index >= size) throw new
IndexOutOfBoundsException("Index: " + index + ",Size: " + size);
- }
-
public final int size()
{
return size;
@@ -354,7 +349,8 @@
@Override
public final ListIterator<E> listIterator(final int index)
{
- rangeCheck(index);
+ if (index < 0 || (index != 0 && index >= size))
+ throw new IndexOutOfBoundsException("Index: " + index + ",
Size: " + size);
return new ListIterator<E>()
{
Show replies by date