From 275ae2d4da6e5ca6b6e97aa2f00a19a759efe011 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Wed, 5 Nov 2014 22:42:20 +0100 Subject: [PATCH] [RECOVERY] Fix potential NPE status reference must be not null to fail recovery --- .../java/org/elasticsearch/indices/recovery/RecoveryTarget.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java b/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java index 61dd911203e..e69db95a175 100644 --- a/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java +++ b/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java @@ -462,7 +462,7 @@ public class RecoveryTarget extends AbstractComponent { @Override public void onFailure(Throwable t) { try (RecoveriesCollection.StatusRef statusRef = onGoingRecoveries.getStatus(recoveryId)) { - if (statusRef == null) { + if (statusRef != null) { logger.error("unexpected error during recovery [{}], failing shard", t, recoveryId); onGoingRecoveries.failRecovery(recoveryId, new RecoveryFailedException(statusRef.status().state(), "unexpected error", t),