i want to iterate through a hash checking for keys and variations of keys.
for example:
<#list myhash?keys as key>
<#if myhash[key] == 'foo'>
do something
<#elseif myhash[key + 'variation'] == 'bar'>
do something else
</#if>
</#list>
if key + 'variation' doesn't exist in myhash, then SimpleHash will do a put
(SimpleHash line 204), which will cause a ConcurrentModificationException
on the next iteration because the hash has been modified.
the reason for the put seems to be to cache the value wrapped in a
TemplateModel. i'm sure this is a good thing for performance reasons, but
it obviously has its side effects.
the solution is to not add a new entry to the hash. if you are just
replacing the value for a particular key with a new value, then you won't
trigger a ConcurrentModificationException. but if the key isn't in the
hash, then you shouldn't add it.
so after line 202, add this:
if (result == null) return tm;
Attila Szegedi
None
None
Public
|
Date: 2008-05-08 13:54
|
|
Date: 2008-04-28 07:52
|
| Field | Old Value | Date | By |
|---|---|---|---|
| status_id | Open | 2008-05-08 13:54 | ddekany |
| close_date | - | 2008-05-08 13:54 | ddekany |
| resolution_id | None | 2008-04-28 07:52 | szegedia |
| assigned_to | nobody | 2008-04-28 07:52 | szegedia |
Copyright © 2009 Geeknet, Inc. All rights reserved. Terms of Use