From 3621277969fec25ad1a04355dd6f24597d8aa492 Mon Sep 17 00:00:00 2001 From: Vladimir Dolzhenko Date: Wed, 17 Oct 2018 17:43:26 +0200 Subject: [PATCH] eliminate NPE on closing restHighLevelClient (if test suite skips all test cases) (cherry picked from 277704c5972148ee62900e781ac64b061aa4b767) --- .../elasticsearch/client/ESRestHighLevelClientTestCase.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/ESRestHighLevelClientTestCase.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/ESRestHighLevelClientTestCase.java index 9217b0b4e55..07c0d818bfa 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/ESRestHighLevelClientTestCase.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/ESRestHighLevelClientTestCase.java @@ -28,6 +28,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentType; +import org.elasticsearch.core.internal.io.IOUtils; import org.elasticsearch.ingest.Pipeline; import org.elasticsearch.test.rest.ESRestTestCase; import org.junit.AfterClass; @@ -53,7 +54,7 @@ public abstract class ESRestHighLevelClientTestCase extends ESRestTestCase { @AfterClass public static void cleanupClient() throws IOException { - restHighLevelClient.close(); + IOUtils.close(restHighLevelClient); restHighLevelClient = null; }