eliminate NPE on closing restHighLevelClient (if test suite skips all test cases)
@@ -29,6 +29,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;
@@ -54,7 +55,7 @@ public abstract class ESRestHighLevelClientTestCase extends ESRestTestCase {
@AfterClass
public static void cleanupClient() throws IOException {
- restHighLevelClient.close();
+ IOUtils.close(restHighLevelClient);
restHighLevelClient = null;
}
