Concurrent modification exception in token cache

Description

Concurrent access to a TokenCache instance may cause a concurrent modification exception:

java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:922)
at java.util.HashMap$EntryIterator.next(HashMap.java:962)
at java.util.HashMap$EntryIterator.next(HashMap.java:960)
at org.entrystore.rest.auth.LoginTokenCache.cleanup(LoginTokenCache.java:41)
at org.entrystore.rest.auth.TokenCache.getTokenValue(TokenCache.java:35)
at org.entrystore.rest.auth.CookieVerifier.verify(CookieVerifier.java:62)

Solution: make sure the access is properly synchronized.

Environment

None

Activity

Show:
Hannes Ebner
December 8, 2015, 11:00 AM

added synchronized blocks to avoid concurrent access to token map

Fixed

Assignee

Hannes Ebner

Reporter

Hannes Ebner

Labels

None

Fix versions

Priority

Critical