First major concern is that I got a ConcurrentModificationException when
iterating over a HashSet - this exception is completely meaningless in the
context of the browser (no threading). There's also not really any
meaningful message in the stack trace:
00:20:24.446 [ERROR] Uncaught exception escaped
java.util.ConcurrentModificationException: null at
java.util.HashMap$HashIterator.nextEntry(HashMap.java:810) at
java.util.HashMap$KeyIterator.next(HashMap.java:845)
The relevant code that causes this is:
private HashMap<ModelAction, HashSet<ModelListener>> models;
// .....
HashSet<ModelListener> listeners = models.get(action);
if (listeners != null) {
for (ModelListener listener : listeners)
listener.modelUpdated(action, info);
}
Replacing it with a regular iterator:
Iterator<ModelListener> iterator = listeners.iterator();
while (iterator.hasNext())
iterator.next().modelUpdated(action, info);
somehow fixes the problem. Is the compiler screwing up in converting the
Java for-each notation into the iterator equivalent, or am I missing
something?
Some background: this succeeds the first time it is called from within an
event handler context (to notify the model to perform a login attempt).
However, it fails the second time it is called when it is called from an
AsyncCallback context (returning the result that it was a successful
login). However, at no point is the HashSet used modified (after startup
where it contains currently 1 element).
Thanks
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---