From 694b8ab95dd298bebd9c1021efb10653cd87afae Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Sat, 18 Jan 2020 14:12:55 +0100 Subject: [PATCH] Fix CorruptedBlobStoreRepository Test (#51128) (#51186) 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 fe53ba3208d..af63d7a2a08 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 abstract class BlobStoreRepository extends AbstractLifecycleComponent imp listener.onFailure(e); } return; + } catch (Exception e) { + listener.onFailure(new RepositoryException(metadata.name(), "Unexpected exception when loading repository data", e)); + return; } } }