Skip to content

Commit 3963638

Browse files
author
Andrey Ershov
committed
Use unmodifiableMap in the constructor
1 parent c00640f commit 3963638

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsResponse.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ public GetSnapshotsResponse(Collection<Response> responses) {
107107
this.failedResponses.put(response.repository, response.error);
108108
}
109109
}
110+
successfulResponses = Collections.unmodifiableMap(successfulResponses);
111+
failedResponses = Collections.unmodifiableMap(failedResponses);
110112
}
111113

112114
public GetSnapshotsResponse() {
@@ -142,14 +144,14 @@ public Set<String> getRepositories() {
142144
* Returns a map of repository name to the list of {@link SnapshotInfo} for each successful response.
143145
*/
144146
public Map<String, List<SnapshotInfo>> getSuccessfulResponses() {
145-
return Map.copyOf(successfulResponses);
147+
return successfulResponses;
146148
}
147149

148150
/**
149151
* Returns a map of repository name to {@link ElasticsearchException} for each unsuccessful response.
150152
*/
151153
public Map<String, ElasticsearchException> getFailedResponses() {
152-
return Map.copyOf(failedResponses);
154+
return failedResponses;
153155
}
154156

155157
/**

0 commit comments

Comments
 (0)