Skip to content

Commit 9d76002

Browse files
authored
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).
1 parent 70faad9 commit 9d76002

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

google-auth-library-java/oauth2_http/javatests/com/google/auth/oauth2/AwsRequestSignerTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import java.net.URI;
4242
import java.nio.charset.StandardCharsets;
4343
import java.util.HashMap;
44+
import java.util.Locale;
4445
import java.util.Map;
4546
import org.junit.Before;
4647
import org.junit.Test;
@@ -64,6 +65,8 @@ public class AwsRequestSignerTest {
6465

6566
@Before
6667
public void setUp() throws IOException {
68+
// Required for date parsing when run in different Locales
69+
Locale.setDefault(Locale.US);
6770
awsSecurityCredentials = retrieveAwsSecurityCredentials();
6871
}
6972

0 commit comments

Comments
 (0)