diff --git a/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/JdbcHttpClientRequestTests.java b/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/JdbcHttpClientRequestTests.java index 008bfced8fd6a..bc86c778f718b 100644 --- a/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/JdbcHttpClientRequestTests.java +++ b/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/JdbcHttpClientRequestTests.java @@ -53,8 +53,11 @@ public static void init() throws Exception { @AfterClass public static void cleanup() { - webServer.close(); - webServer = null; + try { + webServer.close(); + } finally { + webServer = null; + } } public void testBinaryRequestEnabled() throws Exception { diff --git a/x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/HttpClientRequestTests.java b/x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/HttpClientRequestTests.java index 8f5837c95b3d4..01ca2bd0dade1 100644 --- a/x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/HttpClientRequestTests.java +++ b/x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/HttpClientRequestTests.java @@ -59,8 +59,11 @@ public static void init() throws Exception { @AfterClass public static void cleanup() { - webServer.close(); - webServer = null; + try { + webServer.close(); + } finally { + webServer = null; + } } public void testBinaryRequestForCLIEnabled() throws URISyntaxException { @@ -146,7 +149,7 @@ private void assertBinaryRequestForDrivers(boolean isBinary, XContentType xConte HttpClient httpClient = new HttpClient(conCfg); Mode mode = randomFrom(Mode.JDBC, Mode.ODBC); - SqlQueryRequest request = new SqlQueryRequest(query, + SqlQueryRequest request = new SqlQueryRequest(query, null, ZoneId.of("Z"), randomIntBetween(1, 100),