From b69e7e4d35fe183475ec845d4d2f3310a0245b60 Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Mon, 20 Apr 2015 23:58:28 +0200 Subject: [PATCH] Internal: Ensure that explanation descriptions are not null on serialization. As requested on #10399 --- src/main/java/org/elasticsearch/common/lucene/Lucene.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/org/elasticsearch/common/lucene/Lucene.java b/src/main/java/org/elasticsearch/common/lucene/Lucene.java index 9aed6a315eb..229e94a95d2 100644 --- a/src/main/java/org/elasticsearch/common/lucene/Lucene.java +++ b/src/main/java/org/elasticsearch/common/lucene/Lucene.java @@ -559,6 +559,9 @@ public class Lucene { out.writeBoolean(false); } out.writeFloat(explanation.getValue()); + if (explanation.getDescription() == null) { + throw new ElasticsearchIllegalArgumentException("Explanation descriptions should NOT be null\n[" + explanation.toString() + "]"); + } out.writeString(explanation.getDescription()); Explanation[] subExplanations = explanation.getDetails(); if (subExplanations == null) {