Bug 49458 - StorageResolver always exhausted after first use
StorageResolver always exhausted after first use
Status: RESOLVED FIXED
Product: Security - Now in JIRA
Classification: Unclassified
Component: Encryption
unspecified
PC Windows NT
: P2 normal
: ---
Assigned To: XML Security Developers Mailing List
:
Depends on: 49456
Blocks:
  Show dependency tree
 
Reported: 2010-06-17 12:22 UTC by Clement Pellerin
Modified: 2010-06-18 07:20 UTC (History)
0 users



Attachments
source code patch with augmented junit (11.43 KB, text/plain)
2010-06-17 12:22 UTC, Clement Pellerin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Clement Pellerin 2010-06-17 12:22:57 UTC
Created attachment 25608 [details]
source code patch with augmented junit

The StorageResolver creates an iterator once and always returns the same
iterator afterwards. After the iterator is traversed once, it will always
appear empty. Even if the implementation would be changed to reset the iterator to the beginning, the single iterator instance approach will never
be thread-safe.

To reproduce use the junit in attachment.

The solution is to return a new iterator each time.
Since the methods StorageResolver.hasNext() and StorageResolver.next() cannot use this solution, they have been marked deprecated.
The KeyResolvers have been changed to call StorageResolver.getIterator() instead.

This patch assumes the patch in Bug 49456 has already been applied.
Comment 1 coheigea 2010-06-18 07:20:43 UTC
Patch applied, thanks.

Colm.