From 71f6aa129b362eee53b7428481c467375c8037bf Mon Sep 17 00:00:00 2001 From: Andrey Ershov Date: Fri, 24 May 2019 12:56:21 -0400 Subject: [PATCH] BWC --- .../admin/cluster/snapshots/get/GetSnapshotsRequest.java | 4 ++++ .../admin/cluster/snapshots/get/GetSnapshotsResponse.java | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsRequest.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsRequest.java index 7c3f73ecf08bf..4bfd656700684 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsRequest.java @@ -89,6 +89,10 @@ public void writeTo(StreamOutput out) throws IOException { if (out.getVersion().onOrAfter(MULTIPLE_REPOSITORIES_SUPPORT_ADDED)) { out.writeStringArray(repositories); } else { + if (repositories.length != 1) { + throw new IllegalArgumentException("Requesting snapshots from multiple repositories is not supported in versions prior " + + "to " + MULTIPLE_REPOSITORIES_SUPPORT_ADDED.toString()); + } out.writeString(repositories[0]); } out.writeStringArray(snapshots); diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsResponse.java index 81afefbd43e09..89529591abdf7 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsResponse.java @@ -208,7 +208,8 @@ public void writeTo(StreamOutput out) throws IOException { } } else { if (successfulResponses.size() + failedResponses.size() != 1) { - throw new IllegalArgumentException("snapshots from more than one repository are requested"); + throw new IllegalArgumentException("Requesting snapshots from multiple repositories is not supported in versions prior " + + "to " + GetSnapshotsRequest.MULTIPLE_REPOSITORIES_SUPPORT_ADDED.toString()); } if (successfulResponses.size() == 1) {