This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

IdentityHashMap fix


This patch fixes a bug in IdentityHashMap that was causing crashes in 
JNI. The ScribbleWindow demo from qtjava in KDE 2.2.2 runs perfectly for 
me now.

regards

Bryce.


2002-04-02  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>

	* java/util/IdentityHashMap.java (put): Set new threshold correctly
	when resizing table.

Index: IdentityHashMap.java
===================================================================
RCS file: /cvs/gcc/egcs/libjava/java/util/IdentityHashMap.java,v
retrieving revision 1.7
diff -u -r1.7 IdentityHashMap.java
--- IdentityHashMap.java	2002/01/22 22:40:38	1.7
+++ IdentityHashMap.java	2002/04/02 13:52:59
@@ -490,7 +490,7 @@
         table = new Object[old.length * 2 + 2];
         Arrays.fill(table, emptyslot);
         size = 0;
-        threshold = table.length / 4 * 3;
+        threshold = (table.length / 2) / 4 * 3;
 
         for (int i = old.length - 2; i >= 0; i -= 2)
           {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]