• Bug
  • Status: Closed
  • 2 Major
  • Resolution: Fixed
  • Byte Code Transform
  • hhuynh
  • Reporter: teck
  • May 12, 2008
  • 0
  • Watchers: 0
  • July 01, 2008
  • June 16, 2008

Description

Using a plain vanilla Hashtable (ie. no dso-boot jar), one can freely create a keys() or values() view and safely traverse it while the underlying map is being modified.

I haven’t actually tried it yet, but some code like this will throw ConcurrentModificationException when a TC instrumented Hashtable is used, whereas the stock Hashtable will run fine:

    Hashtable ht = new Hashtable();
    ht.put("tim", "eck");
    Enumeration e = ht.keys();
    ht.put("bob", "bob");
    while (e.hasMoreElements()) {
        System.err.println(e.nextElement());
    }

Comments