Skip to content

Commit 9473d7d

Browse files
henrikcozzaKarl Rieb
authored andcommitted
Update JsonDateReaderTest.java
This is to avoid problems with dates in non-English systems.
1 parent 1ed5e42 commit 9473d7d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/test/java/com/dropbox/core/json/JsonDateReaderTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.text.SimpleDateFormat;
77
import java.util.Date;
88
import java.util.GregorianCalendar;
9+
import java.util.Locale;
910

1011
public class JsonDateReaderTest
1112
{
@@ -45,7 +46,7 @@ public void parseDropboxDateTestMany()
4546
private static final ThreadLocal<SimpleDateFormat> dateFormatHolder = new ThreadLocal<SimpleDateFormat>() {
4647
protected SimpleDateFormat initialValue()
4748
{
48-
SimpleDateFormat f = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss ZZZZZ");
49+
SimpleDateFormat f = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss ZZZZZ", Locale.ENGLISH);
4950
f.setTimeZone(JsonDateReader.UTC);
5051
return f;
5152
}
@@ -54,7 +55,7 @@ protected SimpleDateFormat initialValue()
5455
private static final ThreadLocal<SimpleDateFormat> preciseDateFormatHolder = new ThreadLocal<SimpleDateFormat>() {
5556
protected SimpleDateFormat initialValue()
5657
{
57-
SimpleDateFormat f = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss.SSS ZZZZZ");
58+
SimpleDateFormat f = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss.SSS ZZZZZ", Locale.ENGLISH);
5859
f.setTimeZone(JsonDateReader.UTC);
5960
return f;
6061
}
@@ -92,4 +93,4 @@ private static void validateDropboxDateParser(String date)
9293
throw new AssertionError(jq(date) + ": us=Date(" + preciseDateFormatHolder.get().format(ourResult) + "), lib=Date(" + preciseDateFormatHolder.get().format(libResult) + ")");
9394
}
9495
}
95-
}
96+
}

0 commit comments

Comments
 (0)