Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/main/java/com/google/firebase/internal/DateUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;

/**
Expand Down Expand Up @@ -57,9 +58,9 @@ final class DateUtils {
static final String PATTERN_ASCTIME = "EEE MMM d HH:mm:ss yyyy";

private static final SimpleDateFormat[] DEFAULT_PATTERNS = new SimpleDateFormat[] {
new SimpleDateFormat(PATTERN_RFC1123),
new SimpleDateFormat(PATTERN_RFC1036),
new SimpleDateFormat(PATTERN_ASCTIME)
new SimpleDateFormat(PATTERN_RFC1123, Locale.US),
new SimpleDateFormat(PATTERN_RFC1036, Locale.US),
new SimpleDateFormat(PATTERN_ASCTIME, Locale.US)
};

static final TimeZone GMT = TimeZone.getTimeZone("GMT");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;

import org.junit.Test;

public class RetryUnsuccessfulResponseHandlerTest {
Expand Down Expand Up @@ -137,7 +139,8 @@ public void testRetryAfterGivenAsSeconds() throws IOException {

@Test
public void testRetryAfterGivenAsDate() throws IOException {
SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz");
SimpleDateFormat dateFormat =
new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
Date date = new Date(1000);
Clock clock = new FixedClock(date.getTime());
Expand Down
9 changes: 5 additions & 4 deletions src/test/java/com/google/firebase/messaging/MessageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
Expand Down Expand Up @@ -769,7 +770,7 @@ public void testImageInAndroidNotification() throws IOException {
assertJsonEquals(ImmutableMap.of(
"topic", "test-topic", "notification", notification, "android", androidConfig), message);
}

@Test
public void testImageInApnsNotification() throws IOException {
Message message = Message.builder()
Expand Down Expand Up @@ -799,7 +800,7 @@ public void testImageInApnsNotification() throws IOException {
.build();
assertJsonEquals(expected, message);
}

@Test
public void testInvalidColorInAndroidNotificationLightSettings() throws IOException {
try {
Expand All @@ -814,7 +815,7 @@ public void testInvalidColorInAndroidNotificationLightSettings() throws IOExcept
// expected
}
}

@Test
public void testExtendedAndroidNotificationParameters() throws IOException {
long[] vibrateTimings = {1000L, 1001L};
Expand Down Expand Up @@ -848,7 +849,7 @@ public void testExtendedAndroidNotificationParameters() throws IOException {
.put("title", "title")
.put("body", "body")
.build();
String eventTime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS'Z'")
String eventTime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS'Z'", Locale.US)
.format(new Date(1546304523123L));
Map<String, Object> androidConfig = ImmutableMap.<String, Object>builder()
.put("notification", ImmutableMap.<String, Object>builder()
Expand Down