From f9b43a9efacb7a8e5e4ed4ca202417f2ed20799c Mon Sep 17 00:00:00 2001 From: Igor Motov Date: Mon, 11 Nov 2013 20:57:50 -0500 Subject: [PATCH] Failure in onComplete method of AbstractFsBlobContainer#readBlob should trigger onFailure --- .../common/blobstore/fs/AbstractFsBlobContainer.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/elasticsearch/common/blobstore/fs/AbstractFsBlobContainer.java b/src/main/java/org/elasticsearch/common/blobstore/fs/AbstractFsBlobContainer.java index ebf9eb6a83d..e473cc2c5f5 100644 --- a/src/main/java/org/elasticsearch/common/blobstore/fs/AbstractFsBlobContainer.java +++ b/src/main/java/org/elasticsearch/common/blobstore/fs/AbstractFsBlobContainer.java @@ -88,13 +88,17 @@ public abstract class AbstractFsBlobContainer extends AbstractBlobContainer { while ((bytesRead = is.read(buffer)) != -1) { listener.onPartial(buffer, 0, bytesRead); } - } catch (Throwable e) { + } catch (Throwable t) { IOUtils.closeWhileHandlingException(is); - listener.onFailure(e); + listener.onFailure(t); return; } - IOUtils.closeWhileHandlingException(is); - listener.onCompleted(); + try { + IOUtils.closeWhileHandlingException(is); + listener.onCompleted(); + } catch (Throwable t) { + listener.onFailure(t); + } } }); }