From 57bef122db1f5c9ca066ce1b7a2b6cb96bb99130 Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Sat, 18 Jan 2020 12:22:15 +0100 Subject: [PATCH] Fix CorruptedBlobStoreRepository Test (#51128) (#51187) The tests, when creating broken serialized blobs could randomly create a sequence of bytes that is partially readable by the deserializer and then not throw `IOException` but instead `ElasticsearchParseException`. We should just handle these unexpected exceptions downstream properly and pass them wrapped as `RepositoryException` to the listener to fix the test and keep the API consistent. --- .../repositories/blobstore/BlobStoreRepository.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java b/server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java index fe53ba3208d44..af63d7a2a0890 100644 --- a/server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java +++ b/server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java @@ -1110,6 +1110,9 @@ public void getRepositoryData(ActionListener listener) { listener.onFailure(e); } return; + } catch (Exception e) { + listener.onFailure(new RepositoryException(metadata.name(), "Unexpected exception when loading repository data", e)); + return; } } }