Skip to content

Commit 277704c

Browse files
eliminate NPE on closing restHighLevelClient (if test suite skips all test cases)
1 parent 0999c06 commit 277704c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

client/rest-high-level/src/test/java/org/elasticsearch/client/ESRestHighLevelClientTestCase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.elasticsearch.common.util.concurrent.ThreadContext;
3030
import org.elasticsearch.common.xcontent.XContentBuilder;
3131
import org.elasticsearch.common.xcontent.XContentType;
32+
import org.elasticsearch.core.internal.io.IOUtils;
3233
import org.elasticsearch.ingest.Pipeline;
3334
import org.elasticsearch.test.rest.ESRestTestCase;
3435
import org.junit.AfterClass;
@@ -54,7 +55,7 @@ public void initHighLevelClient() throws IOException {
5455

5556
@AfterClass
5657
public static void cleanupClient() throws IOException {
57-
restHighLevelClient.close();
58+
IOUtils.close(restHighLevelClient);
5859
restHighLevelClient = null;
5960
}
6061

0 commit comments

Comments
 (0)