From 7307e37efec6e5aa7675121a664c24060efe086f Mon Sep 17 00:00:00 2001 From: Boaz Leskes Date: Mon, 2 Sep 2013 21:53:00 +0200 Subject: [PATCH] Previously added logging in TransportRefreshAction caused NPE if search shards had errors (or was not yet started/assigned) Better formatting for logging in TransportRefreshAction --- .../indices/refresh/TransportRefreshAction.java | 2 +- .../search/type/TransportSearchTypeAction.java | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/elasticsearch/action/admin/indices/refresh/TransportRefreshAction.java b/src/main/java/org/elasticsearch/action/admin/indices/refresh/TransportRefreshAction.java index 4b71a5f3bd8..7ef1bfe3a1a 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/refresh/TransportRefreshAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/refresh/TransportRefreshAction.java @@ -113,7 +113,7 @@ public class TransportRefreshAction extends TransportBroadcastOperationAction 0) { - sb.append(","); + FirstResult result = firstResults.get(i); + if (result == null) { + continue; // failure } - sb.append(shard); + if (hadOne) { + sb.append(","); + } else { + hadOne = true; + } + sb.append(result.shardTarget()); } + logger.debug("Moving to second phase, based on results from: {}", sb); } moveToSecondPhase();