From 797d3672b7f09d219a0597352c2669b1eeeb510a Mon Sep 17 00:00:00 2001 From: Moritz Mack Date: Wed, 17 Sep 2025 16:42:07 +0200 Subject: [PATCH 01/10] Update bundled JDK to 25 --- build-tools-internal/version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-tools-internal/version.properties b/build-tools-internal/version.properties index b3e291138afdf..8cd550b0b9ffe 100644 --- a/build-tools-internal/version.properties +++ b/build-tools-internal/version.properties @@ -2,7 +2,7 @@ elasticsearch = 9.2.0 lucene = 10.2.2 bundled_jdk_vendor = openjdk -bundled_jdk = 24.0.2+12@fdc5d0102fe0414db21410ad5834341f +bundled_jdk = 25+36@bd75d5f9689641da8e1daabeccb5528b # optional dependencies spatial4j = 0.7 jts = 1.15.0 From fbe6358d9dd76380adc345d880366538eea9f3fe Mon Sep 17 00:00:00 2001 From: Mark Vieira Date: Wed, 17 Sep 2025 11:07:48 -0700 Subject: [PATCH 02/10] Fix UriUtilsTests --- .../org/elasticsearch/xpack/sql/client/UriUtilsTests.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/UriUtilsTests.java b/x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/UriUtilsTests.java index af25b40220979..bf727ce546de9 100644 --- a/x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/UriUtilsTests.java +++ b/x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/UriUtilsTests.java @@ -7,6 +7,7 @@ package org.elasticsearch.xpack.sql.client; import org.elasticsearch.test.ESTestCase; +import org.hamcrest.Matchers; import java.net.URI; import java.util.Arrays; @@ -89,9 +90,10 @@ public void testUnsupportedProtocol() throws Exception { } public void testMalformedWhiteSpace() throws Exception { - assertEquals( - "Invalid connection configuration: Illegal character in authority at index 7: http:// ", - expectThrows(IllegalArgumentException.class, () -> parseURI(" ", DEFAULT_URI)).getMessage() + assertThat( + expectThrows(IllegalArgumentException.class, () -> parseURI(" ", DEFAULT_URI)).getMessage(), + // Use a lenient regex here since later JDKs trim exception message whitespace + Matchers.matchesPattern("^Invalid connection configuration: Illegal character in authority at index 7: http:// ?") ); } From 1fc595dfc3a47eda70d6ea6a372bb7e658b625f1 Mon Sep 17 00:00:00 2001 From: Mark Vieira Date: Wed, 17 Sep 2025 11:08:45 -0700 Subject: [PATCH 03/10] Use static import --- .../org/elasticsearch/xpack/sql/client/UriUtilsTests.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/UriUtilsTests.java b/x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/UriUtilsTests.java index bf727ce546de9..2040f592be2dd 100644 --- a/x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/UriUtilsTests.java +++ b/x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/UriUtilsTests.java @@ -7,7 +7,6 @@ package org.elasticsearch.xpack.sql.client; import org.elasticsearch.test.ESTestCase; -import org.hamcrest.Matchers; import java.net.URI; import java.util.Arrays; @@ -17,6 +16,7 @@ import static org.elasticsearch.xpack.sql.client.UriUtils.appendSegmentToPath; import static org.elasticsearch.xpack.sql.client.UriUtils.parseURI; import static org.elasticsearch.xpack.sql.client.UriUtils.removeQuery; +import static org.hamcrest.Matchers.matchesPattern; public class UriUtilsTests extends ESTestCase { @@ -93,7 +93,7 @@ public void testMalformedWhiteSpace() throws Exception { assertThat( expectThrows(IllegalArgumentException.class, () -> parseURI(" ", DEFAULT_URI)).getMessage(), // Use a lenient regex here since later JDKs trim exception message whitespace - Matchers.matchesPattern("^Invalid connection configuration: Illegal character in authority at index 7: http:// ?") + matchesPattern("^Invalid connection configuration: Illegal character in authority at index 7: http:// ?") ); } From c20b69840e8c94410339b3f38c6f394ba0d4350b Mon Sep 17 00:00:00 2001 From: Moritz Mack Date: Thu, 18 Sep 2025 16:40:30 +0200 Subject: [PATCH 04/10] Fix ESQL operator overflow warning assertions on JDK 25 --- x-pack/plugin/esql/build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/x-pack/plugin/esql/build.gradle b/x-pack/plugin/esql/build.gradle index 00a247f854e50..3e1d426018576 100644 --- a/x-pack/plugin/esql/build.gradle +++ b/x-pack/plugin/esql/build.gradle @@ -96,6 +96,10 @@ interface Injected { } tasks.named("test").configure { + // prevent empty stacktraces on JDK 25 for intrinsic Math.*Exact invocations + // https://bugs.openjdk.org/browse/JDK-8367990 + jvmArgs '-XX:-OmitStackTraceInFastThrow' + def injected = project.objects.newInstance(Injected) // Define the folder to delete and recreate def tempDir = file("build/testrun/test/temp/esql") From 128908c07829f8916e48daa424548443b2e88934 Mon Sep 17 00:00:00 2001 From: Mark Vieira Date: Thu, 18 Sep 2025 09:18:34 -0700 Subject: [PATCH 05/10] Fix more uri parsing tests --- .../test/java/org/elasticsearch/client/RestClientTests.java | 3 ++- .../inference/services/custom/CustomRequestManagerTests.java | 3 ++- .../inference/services/custom/request/CustomRequestTests.java | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/client/rest/src/test/java/org/elasticsearch/client/RestClientTests.java b/client/rest/src/test/java/org/elasticsearch/client/RestClientTests.java index fd36387a46962..12468317d4359 100644 --- a/client/rest/src/test/java/org/elasticsearch/client/RestClientTests.java +++ b/client/rest/src/test/java/org/elasticsearch/client/RestClientTests.java @@ -44,6 +44,7 @@ import static java.util.Collections.singletonList; import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.Matchers.startsWith; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertSame; @@ -105,7 +106,7 @@ public void onSuccess(Response response) { public void onFailure(Exception exception) { try { assertThat(exception, instanceOf(IllegalArgumentException.class)); - assertEquals("Expected scheme name at index 0: ::http:///", exception.getMessage()); + assertThat(exception.getMessage(), startsWith(("Expected scheme name"))); } finally { latch.countDown(); } diff --git a/x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/custom/CustomRequestManagerTests.java b/x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/custom/CustomRequestManagerTests.java index 7e4ee8e8ebbb0..145a305d5f5bc 100644 --- a/x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/custom/CustomRequestManagerTests.java +++ b/x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/custom/CustomRequestManagerTests.java @@ -27,6 +27,7 @@ import static org.elasticsearch.xpack.inference.Utils.inferenceUtilityExecutors; import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.startsWith; import static org.mockito.Mockito.mock; public class CustomRequestManagerTests extends ESTestCase { @@ -81,6 +82,6 @@ public void testCreateRequest_ThrowsException_ForInvalidUrl() { var exception = expectThrows(ElasticsearchStatusException.class, () -> listener.actionGet(TimeValue.timeValueSeconds(30))); assertThat(exception.getMessage(), is("Failed to construct the custom service request")); - assertThat(exception.getCause().getMessage(), is("Failed to build URI, error: Illegal character in path at index 0: ^")); + assertThat(exception.getCause().getMessage(), startsWith("Failed to build URI, error: Illegal character in path")); } } diff --git a/x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/custom/request/CustomRequestTests.java b/x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/custom/request/CustomRequestTests.java index bb83897f27551..aef1a6d3bbbc1 100644 --- a/x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/custom/request/CustomRequestTests.java +++ b/x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/custom/request/CustomRequestTests.java @@ -40,6 +40,7 @@ import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.startsWith; public class CustomRequestTests extends ESTestCase { @@ -380,7 +381,7 @@ public void testCreateRequest_ThrowsException_ForInvalidUrl() { IllegalStateException.class, () -> new CustomRequest(RerankParameters.of(new QueryAndDocsInputs("query string", List.of("abc", "123"))), model) ); - assertThat(exception.getMessage(), is("Failed to build URI, error: Illegal character in path at index 0: ^")); + assertThat(exception.getMessage(), startsWith("Failed to build URI, error: Illegal character in path")); } private static String convertToString(InputStream inputStream) throws IOException { From 341cca115325f36a5a02b2a4c753f707b81b53e8 Mon Sep 17 00:00:00 2001 From: Moritz Mack Date: Thu, 18 Sep 2025 18:31:03 +0200 Subject: [PATCH 06/10] Update x-pack/plugin/esql/build.gradle --- x-pack/plugin/esql/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/plugin/esql/build.gradle b/x-pack/plugin/esql/build.gradle index 3e1d426018576..734c0b62eb729 100644 --- a/x-pack/plugin/esql/build.gradle +++ b/x-pack/plugin/esql/build.gradle @@ -98,6 +98,7 @@ interface Injected { tasks.named("test").configure { // prevent empty stacktraces on JDK 25 for intrinsic Math.*Exact invocations // https://bugs.openjdk.org/browse/JDK-8367990 + // https://github.com/elastic/elasticsearch/issues/135009 jvmArgs '-XX:-OmitStackTraceInFastThrow' def injected = project.objects.newInstance(Injected) From 00d885e12621a32561771139457f234b54ff1036 Mon Sep 17 00:00:00 2001 From: Mark Vieira Date: Thu, 18 Sep 2025 10:45:04 -0700 Subject: [PATCH 07/10] Fix another url test --- .../xpack/sql/jdbc/JdbcConfigurationTests.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/JdbcConfigurationTests.java b/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/JdbcConfigurationTests.java index 970b8b6d572e4..d309346bb4bbd 100644 --- a/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/JdbcConfigurationTests.java +++ b/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/JdbcConfigurationTests.java @@ -11,6 +11,7 @@ import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xpack.sql.client.SslConfig; import org.elasticsearch.xpack.sql.client.SuppressForbidden; +import org.hamcrest.Matchers; import java.net.URI; import java.net.URISyntaxException; @@ -43,12 +44,7 @@ private JdbcConfiguration ci(String url) throws SQLException { public void testInvalidUrl() { JdbcSQLException e = expectThrows(JdbcSQLException.class, () -> ci("jdbc:es://localhost9200/?ssl=#5#")); - assertEquals( - "Invalid URL: Invalid connection configuration: Illegal character in fragment at index 28: " - + "http://localhost9200/?ssl=#5#; format should be " - + "[jdbc:[es|elasticsearch]://[[http|https]://]?[host[:port]]?/[prefix]?[\\?[option=value]&]*]", - e.getMessage() - ); + assertThat(e.getMessage(), Matchers.startsWith("Invalid URL: Invalid connection configuration: Illegal character in fragment")); } public void testJustThePrefix() throws Exception { From c9eb22d42ed612c4fb87bdfcfc002e6f9d05eaee Mon Sep 17 00:00:00 2001 From: Mark Vieira Date: Thu, 18 Sep 2025 12:49:55 -0700 Subject: [PATCH 08/10] Fix FIPS failures? --- build-tools-internal/src/main/groovy/elasticsearch.fips.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build-tools-internal/src/main/groovy/elasticsearch.fips.gradle b/build-tools-internal/src/main/groovy/elasticsearch.fips.gradle index 7c77fb8cad38f..8c8469dcc1126 100644 --- a/build-tools-internal/src/main/groovy/elasticsearch.fips.gradle +++ b/build-tools-internal/src/main/groovy/elasticsearch.fips.gradle @@ -103,6 +103,7 @@ if (buildParams.inFipsJvm) { task.systemProperty('java.security.policy', String.format(Locale.ROOT, "=%s", fipsPolicy)) task.systemProperty('javax.net.ssl.trustStore', fipsTrustStore) task.systemProperty('org.bouncycastle.fips.approved_only', 'true') + task.systemProperty('jdk.includeInExceptions', 'hostInfo') } } } From 1f6a3c85af539b947ee417bc428c77b3a31d973b Mon Sep 17 00:00:00 2001 From: Mark Vieira Date: Thu, 18 Sep 2025 15:25:05 -0700 Subject: [PATCH 09/10] Fix another one --- .../client/RestClientMultipleHostsIntegTests.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/rest/src/test/java/org/elasticsearch/client/RestClientMultipleHostsIntegTests.java b/client/rest/src/test/java/org/elasticsearch/client/RestClientMultipleHostsIntegTests.java index 9a5f239970469..cc06db937e52b 100644 --- a/client/rest/src/test/java/org/elasticsearch/client/RestClientMultipleHostsIntegTests.java +++ b/client/rest/src/test/java/org/elasticsearch/client/RestClientMultipleHostsIntegTests.java @@ -49,6 +49,7 @@ import static org.elasticsearch.client.RestClientTestUtil.randomErrorNoRetryStatusCode; import static org.elasticsearch.client.RestClientTestUtil.randomOkStatusCode; import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.Matchers.startsWith; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; @@ -314,7 +315,7 @@ public void testNodeSelector() throws Exception { } catch (ConnectException e) { // Windows isn't consistent here. Sometimes the message is even null! if (false == System.getProperty("os.name").startsWith("Windows")) { - assertEquals("Connection refused", e.getMessage()); + assertThat(e.getMessage(), startsWith("Connection refused")); } } } else { From 63fce46a707148b32041515133371d1dd8bc0af7 Mon Sep 17 00:00:00 2001 From: Moritz Mack Date: Fri, 19 Sep 2025 11:27:05 +0200 Subject: [PATCH 10/10] fix fips exceptions --- .../src/main/groovy/elasticsearch.fips.gradle | 1 - build-tools-internal/src/main/resources/fips_java.security | 3 +++ .../src/main/resources/fips_java_oracle.security | 3 +++ test/test-clusters/src/main/resources/fips/fips_java.security | 3 +++ .../src/main/resources/fips/fips_java_oracle.security | 4 ++++ 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/build-tools-internal/src/main/groovy/elasticsearch.fips.gradle b/build-tools-internal/src/main/groovy/elasticsearch.fips.gradle index 8c8469dcc1126..7c77fb8cad38f 100644 --- a/build-tools-internal/src/main/groovy/elasticsearch.fips.gradle +++ b/build-tools-internal/src/main/groovy/elasticsearch.fips.gradle @@ -103,7 +103,6 @@ if (buildParams.inFipsJvm) { task.systemProperty('java.security.policy', String.format(Locale.ROOT, "=%s", fipsPolicy)) task.systemProperty('javax.net.ssl.trustStore', fipsTrustStore) task.systemProperty('org.bouncycastle.fips.approved_only', 'true') - task.systemProperty('jdk.includeInExceptions', 'hostInfo') } } } diff --git a/build-tools-internal/src/main/resources/fips_java.security b/build-tools-internal/src/main/resources/fips_java.security index 1018b1b96acc2..b1fc913df148f 100644 --- a/build-tools-internal/src/main/resources/fips_java.security +++ b/build-tools-internal/src/main/resources/fips_java.security @@ -49,3 +49,6 @@ jdk.xml.dsig.secureValidationPolicy=\ noRetrievalMethodLoops jceks.key.serialFilter = java.base/java.lang.Enum;java.base/java.security.KeyRep;\ java.base/java.security.KeyRep$Type;java.base/javax.crypto.spec.SecretKeySpec;!* + +# Needed since JDK25 to match the default config in the out-of-the-box java.security +jdk.includeInExceptions=hostInfoExclSocket diff --git a/build-tools-internal/src/main/resources/fips_java_oracle.security b/build-tools-internal/src/main/resources/fips_java_oracle.security index 875151a058eeb..c8c0662f27832 100644 --- a/build-tools-internal/src/main/resources/fips_java_oracle.security +++ b/build-tools-internal/src/main/resources/fips_java_oracle.security @@ -50,3 +50,6 @@ jdk.xml.dsig.secureValidationPolicy=\ noRetrievalMethodLoops jceks.key.serialFilter = java.base/java.lang.Enum;java.base/java.security.KeyRep;\ java.base/java.security.KeyRep$Type;java.base/javax.crypto.spec.SecretKeySpec;!* + +# Needed since JDK25 to match the default config in the out-of-the-box java.security +jdk.includeInExceptions=hostInfoExclSocket diff --git a/test/test-clusters/src/main/resources/fips/fips_java.security b/test/test-clusters/src/main/resources/fips/fips_java.security index 1018b1b96acc2..b1fc913df148f 100644 --- a/test/test-clusters/src/main/resources/fips/fips_java.security +++ b/test/test-clusters/src/main/resources/fips/fips_java.security @@ -49,3 +49,6 @@ jdk.xml.dsig.secureValidationPolicy=\ noRetrievalMethodLoops jceks.key.serialFilter = java.base/java.lang.Enum;java.base/java.security.KeyRep;\ java.base/java.security.KeyRep$Type;java.base/javax.crypto.spec.SecretKeySpec;!* + +# Needed since JDK25 to match the default config in the out-of-the-box java.security +jdk.includeInExceptions=hostInfoExclSocket diff --git a/test/test-clusters/src/main/resources/fips/fips_java_oracle.security b/test/test-clusters/src/main/resources/fips/fips_java_oracle.security index 875151a058eeb..c50f85202a1e4 100644 --- a/test/test-clusters/src/main/resources/fips/fips_java_oracle.security +++ b/test/test-clusters/src/main/resources/fips/fips_java_oracle.security @@ -50,3 +50,7 @@ jdk.xml.dsig.secureValidationPolicy=\ noRetrievalMethodLoops jceks.key.serialFilter = java.base/java.lang.Enum;java.base/java.security.KeyRep;\ java.base/java.security.KeyRep$Type;java.base/javax.crypto.spec.SecretKeySpec;!* + +# Needed since JDK25 to match the default config in the out-of-the-box java.security +jdk.includeInExceptions=hostInfoExclSocket +