From a12fe3e3ef2f3f5151a9c428cd3f4dcf69be2aec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B6rn=20SVENSSON?= Date: Sun, 1 Oct 2023 10:25:03 +0200 Subject: [PATCH] Force English locale for date tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using java.text.SimpleDateFormat without a locale, the system default locale will be considered and if that is not set to an English variant, the "EEE" part of the date string will be in a non-English language. To overcome this, ensure that the English locale is used for all tests where a java.util.Date is stringified. Signed-off-by: Torbjörn SVENSSON --- .../eclipse/equinox/http/servlet/tests/DispatchingTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/DispatchingTest.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/DispatchingTest.java index f1fbf291290..6c63301b2f8 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/DispatchingTest.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/DispatchingTest.java @@ -1284,7 +1284,7 @@ public void run() { @Test public void test_headers_include() throws Exception { - SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz"); + SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); format.setTimeZone(TimeZone.getTimeZone("GMT")); final long date1 = System.currentTimeMillis() - (1000*60*60*24*365*30); final long date2 = System.currentTimeMillis() - (1000*60*60*24*365*40); @@ -1358,7 +1358,7 @@ protected void service(HttpServletRequest request, HttpServletResponse response) @Test public void test_headers_forward() throws Exception { - SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz"); + SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); format.setTimeZone(TimeZone.getTimeZone("GMT")); final long date1 = System.currentTimeMillis() - (1000*60*60*24*365*30); final long date2 = System.currentTimeMillis() - (1000*60*60*24*365*40);