Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-6203

[classlib][luni] java.util.Hashtable.remove(.) throws StackOverflowError while RI doesn't

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.0M9
    • Fix Version/s: 5.0M10
    • Component/s: Classlib
    • Labels:
      None
    • Estimated Complexity:
      Moderate

      Description

      Given a test case below [1], RI passes it while HARMONY throws a java.lang.StackOverflowError error. The stack trace is given as [2], this error is thrown due to its hashCode method.

      [1] Test Case:
      public void test_HashTable_remove() {
      Hashtable hashTable = new Hashtable();
      Set keySet = hashTable.keySet();
      hashTable.put(hashTable, keySet);
      hashTable.remove(hashTable);
      }

      [2] Stack Trace:
      java.lang.StackOverflowError
      at java.util.Collections$SynchronizedCollection.iterator(Collections.java:449)
      at java.util.Hashtable.hashCode(Hashtable.java:541)
      at java.util.AbstractSet.hashCode(AbstractSet.java:79)
      at java.util.Collections$SynchronizedSet.hashCode(Collections.java:832)
      at java.util.Hashtable.hashCode(Hashtable.java:547)
      at java.util.AbstractSet.hashCode(AbstractSet.java:79)
      at java.util.Collections$SynchronizedSet.hashCode(Collections.java:832)

        Activity

        Hide
        zhoukevin Kevin Zhou added a comment -

        Thanks, Tim.

        Show
        zhoukevin Kevin Zhou added a comment - Thanks, Tim.
        Hide
        tellison Tim Ellison added a comment -

        Thanks Kevin.

        Patch applied to LUNI module at repo revision r773884.

        Please verify it was applied as you expected.

        Show
        tellison Tim Ellison added a comment - Thanks Kevin. Patch applied to LUNI module at repo revision r773884. Please verify it was applied as you expected.
        Hide
        zhoukevin Kevin Zhou added a comment -

        Would you please help to try it?

        Show
        zhoukevin Kevin Zhou added a comment - Would you please help to try it?
        Hide
        zhoukevin Kevin Zhou added a comment -

        The below test case [1] shows that this also happens to the constructor of Hashtable.

        [1] Test Case:
        public void test_HashTable_Constructor() {
        Hashtable hashTable = new Hashtable();
        hashTable.put(hashTable, hashTable.keySet());
        new Hashtable(hashTable);
        }

        Show
        zhoukevin Kevin Zhou added a comment - The below test case [1] shows that this also happens to the constructor of Hashtable. [1] Test Case: public void test_HashTable_Constructor() { Hashtable hashTable = new Hashtable(); hashTable.put(hashTable, hashTable.keySet()); new Hashtable(hashTable); }

          People

          • Assignee:
            tellison Tim Ellison
            Reporter:
            zhoukevin Kevin Zhou
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 48h
              48h
              Remaining:
              Remaining Estimate - 48h
              48h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development