Skip to content
Snippets Groups Projects
Commit ae369e17 authored by Kalle Raita's avatar Kalle Raita
Browse files

Clone System properties before iterating

Iterating over the live set retrieved from System.getProperties() can
cause trouble as any modification to the System properties during
iteration here will trigger concurrent modification exception. It's
safer to first clone the live set and iterate over the clone.

Bug: 36820084
Test: 40000 iterations of CTS unit tests
Change-Id: I647a6cc8ab9d3a51204e635bfd3250c035a77e68
parent 8bc2748f
No related branches found
No related tags found
No related merge requests found
......@@ -73,8 +73,8 @@ public final class EasyMockProperties {
}
}
// Then overload it with system properties
for (Map.Entry<Object, Object> entry : System.getProperties()
.entrySet()) {
for (Map.Entry<Object, Object> entry : ((Properties)System.getProperties()
.clone()).entrySet()) {
if (entry.getKey() instanceof String
&& entry.getKey().toString().startsWith(PREFIX)) {
properties.put(entry.getKey(), entry.getValue());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment