Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent ConcurrentModificationException thrown from Metadata class #935

Merged
merged 1 commit into from
Sep 17, 2020

Conversation

fractalwrench
Copy link
Contributor

Goal

Prevents a ConcurrentModificationException from being thrown in the internally used MetaData class.

MetaData does correctly use a ConcurrentHashMap as the default value for the store property, but within the copy() method supplies a regular HashMap. Whenever client.notify() is invoked the global metadata state is copied, which can result in a ConcurrentModificationException being thrown in subsequent edits.

This changeset resolves the problem by enforcing that store must be a ConcurrentHashMap.

Testing

Added a unit test which throws an exception without the changes, and confirmed that it no longer throws an exception.

@fractalwrench fractalwrench force-pushed the PLAT-5039/concurrent-modification-fix branch from adfe774 to 20c3377 Compare September 16, 2020 16:01
@bugsnagbot
Copy link
Collaborator

Android notifier sizes

Format Size impact of Bugsnag (kB) Size impact of Bugsnag when Minified (kB)
APK 1437.78 1358.79
arm64_v8a 369.24 287.33
armeabi 348.77 266.85
armeabi_v7a 328.29 250.47
x86 406.1 324.19
x86_64 389.72 307.81

Generated by 🚫 Danger

@fractalwrench fractalwrench marked this pull request as ready for review September 17, 2020 08:06
@fractalwrench fractalwrench merged commit 6a40527 into next Sep 17, 2020
@fractalwrench fractalwrench deleted the PLAT-5039/concurrent-modification-fix branch September 17, 2020 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants