From 29dd1bb8880a86371b31e73f68e4220481c5f80a Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Thu, 27 Nov 2014 10:17:51 +0100 Subject: [PATCH] Removed error log for null values Original commit: elastic/x-pack-elasticsearch@4477fc1c2ad6a42c11a0671ed1d37da5699e493f --- .../org/elasticsearch/alerts/actions/AlertActionEntry.java | 4 +++- .../elasticsearch/alerts/actions/AlertActionManager.java | 6 +----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/elasticsearch/alerts/actions/AlertActionEntry.java b/src/main/java/org/elasticsearch/alerts/actions/AlertActionEntry.java index 6e78815a268..c0019c7fa16 100644 --- a/src/main/java/org/elasticsearch/alerts/actions/AlertActionEntry.java +++ b/src/main/java/org/elasticsearch/alerts/actions/AlertActionEntry.java @@ -195,7 +195,9 @@ public class AlertActionEntry implements ToXContent { historyEntry.endObject(); historyEntry.field("request"); AlertUtils.writeSearchRequest(searchRequest, historyEntry, params); - historyEntry.field("response", searchResponse); + if (searchResponse != null) { + historyEntry.field("response", searchResponse); + } historyEntry.startObject("actions"); for (AlertAction action : actions) { diff --git a/src/main/java/org/elasticsearch/alerts/actions/AlertActionManager.java b/src/main/java/org/elasticsearch/alerts/actions/AlertActionManager.java index c8514f42041..b72a637d953 100644 --- a/src/main/java/org/elasticsearch/alerts/actions/AlertActionManager.java +++ b/src/main/java/org/elasticsearch/alerts/actions/AlertActionManager.java @@ -240,11 +240,7 @@ public class AlertActionManager extends AbstractComponent { throw new ElasticsearchIllegalArgumentException("Unexpected field [" + currentFieldName + "]"); } } else { - if (token == XContentParser.Token.VALUE_NULL) { - logger.warn("Got null value for [{}]", currentFieldName); - } else { - throw new ElasticsearchIllegalArgumentException("Unexpected token [" + token + "] for [" + currentFieldName + "]"); - } + throw new ElasticsearchIllegalArgumentException("Unexpected token [" + token + "] for [" + currentFieldName + "]"); } } } catch (IOException e) {