Skip to content

Commit 0411f86

Browse files
eliminate NPE on closing restHighLevelClient (if test suite skips all test cases)
1 parent 1cd27e7 commit 0411f86

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
@@ -28,6 +28,7 @@
2828
import org.elasticsearch.common.settings.Settings;
2929
import org.elasticsearch.common.xcontent.XContentBuilder;
3030
import org.elasticsearch.common.xcontent.XContentType;
31+
import org.elasticsearch.core.internal.io.IOUtils;
3132
import org.elasticsearch.ingest.Pipeline;
3233
import org.elasticsearch.test.rest.ESRestTestCase;
3334
import org.junit.AfterClass;
@@ -50,7 +51,7 @@ public void initHighLevelClient() throws IOException {
5051

5152
@AfterClass
5253
public static void cleanupClient() throws IOException {
53-
restHighLevelClient.close();
54+
IOUtils.close(restHighLevelClient);
5455
restHighLevelClient = null;
5556
}
5657

0 commit comments

Comments
 (0)