Closed shadyabarada closed 1 year ago
@ternovtsi
In fact the iterator with some data structures like a hash map are not protected from concurrent modification exceptions. You can check my ticket where I added a sample code that does reproduce it.
Regarding this ticket, you can now test again, the issue apparently was from the test key names - now whenever you use hashmap data structure type with the msGroupStates object, your test will fail.
Let me know if you face further issues.
I also believe there is no official formatting for Java, there is just preferences, maybe we should create a shared formatting xml file for the whole team to use so that we don't find formatting changes during PR and we all be aligned on one.
@ternovtsi
In fact the iterator with some data structures like a hash map are not protected from concurrent modification exceptions. You can check my ticket where I added a sample code that does reproduce it.
Regarding this ticket, you can now test again, the issue apparently was from the test key names - now whenever you use hashmap data structure type with the msGroupStates object, your test will fail.
Let me know if you face further issues.
I also believe there is no official formatting for Java, there is just preferences, maybe we should create a shared formatting xml file for the whole team to use so that we don't find formatting changes during PR and we all be aligned on one.
You're right it is protected only when removing items, sorry forgot that
Also, remove unused imports, please)
@ternovtsi removed extra spaces and imports, and regarding the formatting I don't see there difference between my code and the shared doc. could you please point it out in case I missed it.
@ternovtsi removed extra spaces and imports, and regarding the formatting I don't see there difference between my code and the shared doc. could you please point it out in case I missed it.
Everything i mentioned is in doc. For example: 7.9 try catch, 7.4 if statement
…RequestsAllowed
Please have a look at our guidelines for contributions and consider the following before you submit the PR:
CHANGELOG.md
been updated?Description
This issue is occuring because we are iterating on a hashMap that at some point can be modified by other running threads. This will cause a concurrent modification exception which is very common in data structures with iterators. One solution is to use the ConcurrentHashMap instead of HashMap given that our map is exposed to multiple modifications in our code.
Related PRs or issues
AB#96392 https://github.com/microsoft/appcenter-sdk-android/issues/1666/
Misc
Add what's missing, notes on what you tested, additional thoughts or questions.