This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
PATCH: IdentityHashMap fixlet
- To: java-patches at gcc dot gnu dot org
- Subject: PATCH: IdentityHashMap fixlet
- From: Jeff Sturm <jsturm at one-point dot com>
- Date: Sat, 18 Aug 2001 18:23:01 -0400 (EDT)
After updating my tree I began to see ArrayIndexOutOfBoundsExeptions
coming from JNI code. This stops the exceptions. (Other than this I
haven't really tested IdentityHashMap at all.)
2001-08-18 Jeff Sturm <jsturm@one-point.com>
* java/util/IdentityHashMap.java (get): Fix off-by-one error.
(put): Likewise.
Index: java/util/IdentityHashMap.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/IdentityHashMap.java,v
retrieving revision 1.1
diff -u -p -r1.1 IdentityHashMap.java
--- IdentityHashMap.java 2001/08/15 20:46:48 1.1
+++ IdentityHashMap.java 2001/08/18 21:30:57
@@ -172,7 +172,7 @@ public class IdentityHashMap extends Abs
if (table[h] == emptyslot)
return null;
h += 2;
- if (h > table.length)
+ if (h >= table.length)
h = 0;
if (h == save)
return null;
@@ -257,7 +257,7 @@ public class IdentityHashMap extends Abs
break;
}
h += 2;
- if (h > table.length)
+ if (h >= table.length)
h = 0;
if (h == save)
break;