Skip to content

Commit f2024e3

Browse files
authored
[CI] UrlDecodeTests class failing (#135308)
- Change the expected error message for bad decoder input test cases depending on the JDK version. - Prior to JDK25, the exception message is `Illegal hex characters in escape (%) pattern - Error at index 0 in ...` but it has changed to `Illegal hex characters in escape (%) pattern - not a hexadecimal digit ...`.
1 parent ac8acbb commit f2024e3

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/AbstractUrlEncodeDecodeTestCase.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@ public static Iterable<Object[]> createParameters(PercentCodecTestType codecTest
112112
// bad inputs for decoder tests aren't encoded first (as they wouldn't be bad then), but are expected to be handled
113113
// gracefully by the decoder.
114114

115+
boolean isJdk25plus = Runtime.version().feature() >= 25;
116+
117+
String errorMessage1 = "Line 1:1: java.lang.IllegalArgumentException: "
118+
+ "URLDecoder: Illegal hex characters in escape (%%) pattern - not a hexadecimal digit: \"%s\" = %s";
119+
120+
String errorMessage2 = "Line 1:1: java.lang.IllegalArgumentException: "
121+
+ "URLDecoder: Illegal hex characters in escape (%%) pattern - Error at index 0 in: \"%s\"";
122+
115123
List<Tuple<String, String>> tuples = List.of(
116124
// incomplete sequence
117125
Tuple.tuple("%1", "Line 1:1: java.lang.IllegalArgumentException: URLDecoder: Incomplete trailing escape (%) pattern"),
@@ -122,15 +130,15 @@ public static Iterable<Object[]> createParameters(PercentCodecTestType codecTest
122130
// invalid hex digits
123131
Tuple.tuple(
124132
"%xy",
125-
"Line 1:1: java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern - "
126-
+ "not a hexadecimal digit: \"x\" = 120"
133+
// the error message changed in JDK 25
134+
isJdk25plus ? String.format(Locale.ROOT, errorMessage1, "x", 120) : String.format(Locale.ROOT, errorMessage2, "xy")
127135
),
128136

129137
// valid and invalid sequences
130138
Tuple.tuple(
131139
"foo+bar%20qux%mn",
132-
"Line 1:1: java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern - "
133-
+ "not a hexadecimal digit: \"m\" = 109"
140+
// the error message changed in JDK 25
141+
isJdk25plus ? String.format(Locale.ROOT, errorMessage1, "m", 109) : String.format(Locale.ROOT, errorMessage2, "mn")
134142
)
135143
);
136144

0 commit comments

Comments
 (0)