Skip to content

Commit 93b9a13

Browse files
authored
Fix sporadic test failure (#3820)
1 parent f9c6ba7 commit 93b9a13

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

smoke-tests/framework/src/main/java/com/microsoft/applicationinsights/smoketest/fakeingestion/MockedAppInsightsIngestionServlet.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ int getItemCount() {
6565
List<Envelope> getItemsByType(String type) {
6666
Objects.requireNonNull(type, "type");
6767
synchronized (multimapLock) {
68-
return type2envelope.get(type);
68+
// need to make a copy to avoid ConcurrentModificationException
69+
// if the caller iterates over it at the same time as another telemetry item arrives
70+
return new ArrayList<>(type2envelope.get(type));
6971
}
7072
}
7173

0 commit comments

Comments
 (0)