From aeb12182241e75cba664975a83bbcfa2449fb0f5 Mon Sep 17 00:00:00 2001 From: Josh Mahonin Date: Tue, 13 Dec 2022 19:05:37 -0500 Subject: [PATCH] fix: Enforce Locale.US for AwsRequestSignerTest (#1111) Date parsing can fail in other locales. Specifically, in `en-CA` (Canada), the tests's defined date `Mon, 09 Sep 2011 23:36:00 GMT` won't parse correctly, as the weekday short name for the locale is `Mon.` (extra period). --- .../javatests/com/google/auth/oauth2/AwsRequestSignerTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/oauth2_http/javatests/com/google/auth/oauth2/AwsRequestSignerTest.java b/oauth2_http/javatests/com/google/auth/oauth2/AwsRequestSignerTest.java index fd2c26d12..3bac05214 100644 --- a/oauth2_http/javatests/com/google/auth/oauth2/AwsRequestSignerTest.java +++ b/oauth2_http/javatests/com/google/auth/oauth2/AwsRequestSignerTest.java @@ -41,6 +41,7 @@ import java.net.URI; import java.nio.charset.StandardCharsets; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import org.junit.Before; import org.junit.Test; @@ -64,6 +65,8 @@ public class AwsRequestSignerTest { @Before public void setUp() throws IOException { + // Required for date parsing when run in different Locales + Locale.setDefault(Locale.US); awsSecurityCredentials = retrieveAwsSecurityCredentials(); }