Bug 47779 - ConcurrentModificationException in XMLUtils
ConcurrentModificationException in XMLUtils
Status: RESOLVED FIXED
Product: Security - Now in JIRA
Classification: Unclassified
Component: Signature
Java 1.4.2
PC Windows XP
: P2 major
: ---
Assigned To: XML Security Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2009-09-03 06:00 UTC by mirko
Modified: 2009-10-08 04:31 UTC (History)
0 users



Attachments
patch (1.46 KB, patch)
2009-09-03 06:44 UTC, mirko
Details | Diff
2nd patch (2.22 KB, patch)
2009-09-03 06:51 UTC, mirko
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mirko 2009-09-03 06:00:21 UTC
XMLUtils.createElementInSignatureSpace is not threadsafe.

There is a chance of getting a ConcurrentModificationException if two threads try to access this method at the same time because of an unsynchronized access to the Hashtable named 'namePrefixes'.
Comment 1 mirko 2009-09-03 06:44:25 UTC
Created attachment 24204 [details]
patch
Comment 2 mirko 2009-09-03 06:51:14 UTC
Created attachment 24205 [details]
2nd patch

fixes the same problem in another method
Comment 3 coheigea 2009-09-04 08:43:32 UTC
Good catch! Would it not be better to just declare namePrefixes as:

Collections.synchronizedMap(new HashMap());

That would remove the call to Collections.unmodifiableMap each time the method is invoked, as well as the synchronized block.

Colm.
Comment 4 coheigea 2009-10-08 04:31:22 UTC
Fix applied.

Colm.
Comment 5 coheigea 2009-10-08 04:31:22 UTC
Fix applied.

Colm.