libgcj/2357: HashMap does not handle initialCapacity=0 correctly
mark@klomp.org
mark@klomp.org
Fri Mar 23 04:26:00 GMT 2001
>Number: 2357
>Category: libgcj
>Synopsis: HashMap does not handle initialCapacity=0 correctly
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Mar 23 04:26:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: mark@klomp.org
>Release: gcc version 3.0 20010323 (prerelease)
>Organization:
>Environment:
>Description:
When the initialCapacity of a HashMap is zero then bucket.length will be zero and then you will get a ArithmetichException in the hash() method.
import java.util.HashMap;
public class HashMapTest {
public static void main(String args[]) {
HashMap map = new HashMap(0);
map.get(new Object());
}
}
Exception in thread "main" java.lang.ArithmeticException: / by zero
at 0x4016836d: _Jv_ThrowSignal (/usr/local/gcc/lib/libgcj.so.1)
at 0x40168402: _Jv_ThrowSignal (/usr/local/gcc/lib/libgcj.so.1)
at 0x401dc840: java.util.HashMap.hash(java.lang.Object) (/usr/local/gcc/lib/libgcj.so.1)
at 0x401dc0a4: java.util.HashMap.get(java.lang.Object) (/usr/local/gcc/lib/libgcj.so.1)
at 0x08048a82: HashMapTest.main(java.lang.String[]) (/tmp/HashMapTest.java:6) at 0x4017f0a5: gnu.gcj.runtime.FirstThread.run() (/usr/local/gcc/lib/libgcj.so.1)
at 0x40189d92: java.lang.Thread.run_(java.lang.Object) (/usr/local/gcc/lib/libgcj.so.1)
at 0x402a2e68: _Jv_ThreadSetPriority(_Jv_Thread_t, int) (/usr/local/gcc/lib/libgcj.so.1)
at 0x4045653d: GC_start_routine (/usr/local/gcc/lib/libgcjgc.so.1)
at 0x4046fc75: pthread_detach (/lib/libpthread.so.0)
at 0x40559eba: __clone (/lib/libc.so.6)
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-prs
mailing list