Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4506459

Hashtable.hashCode causes stack overflow if hashtable was put into itself

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.3.1_01
    • 1.3.1_01
    • core-libs
    • None
    • 01a
    • x86
    • windows_nt
    • Verified

                During our applet compatibility testing, we found a small amount
        of applets run into a problem in Hashtable.hashCode() and result in
                java.lang.StackOverflowError
                 at java.util.Hashtable$Entry.hashCode(Unknown Source)

                The issue is that these applets put the hashtable object into itself
        for some unknown reasons, and try to generate a hashCode. This causes
        the following code in java.util.Hashtable to execute:

            public synchronized int hashCode() {
                int h = 0;
                Iterator i = entrySet().iterator();
                while (i.hasNext())
                    h += i.next().hashCode();
                return h;
            }

                It will end up being a recursive call and cause stack overflow.
        These applets work fine in MS VM because M$'s implementation of hashCode()
        doesn't rely on the hashCode of the entries.

        URL: www.playsite.com
        Release: J2SE v1.3.1_01a, 1.4.
        Platform: Win32

              jjb Josh Bloch
              stanleyh Stanley Ho (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: