Skip to content

Commit 25367bb

Browse files
author
Peter Alfonsi
committed
Fix forbiddenApis
Signed-off-by: Peter Alfonsi <[email protected]>
1 parent d9eee10 commit 25367bb

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

server/src/internalClusterTest/java/org/opensearch/search/query/BooleanQueryIT.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,16 @@ public void testMustNotDateRangeWithFormatAndTimeZoneRewrite() throws Exception
159159
);
160160
}
161161

162+
private String padZeros(int value, int length) {
163+
// String.format() not allowed
164+
String ret = Integer.toString(value);
165+
if (ret.length() < length) {
166+
ret = "0".repeat(length - ret.length()) + ret;
167+
}
168+
return ret;
169+
}
170+
162171
private String getDate(int day, int hour) {
163-
return "2016-01-" + String.format("%02d", day) + "T" + String.format("%02d", hour) + ":00:00.000";
172+
return "2016-01-" + padZeros(day, 2) + "T" + padZeros(hour, 2) + ":00:00.000";
164173
}
165174
}

0 commit comments

Comments
 (0)