diff options
author | Alan Young <consult.awy@gmail.com> | 2015-01-22 15:19:01 (GMT) |
---|---|---|
committer | Alan Young <consult.awy@gmail.com> | 2015-04-02 14:00:58 (GMT) |
commit | ba594c6d3192b048737952b248e6ee2b8584ec88 (patch) | |
tree | ff509858f3f57ff4d231bb15101599e5134119b0 /src/com | |
parent | c812879b371f6f1cf268ca4cd48413ec38063527 (diff) | |
download | stroke-ba594c6d3192b048737952b248e6ee2b8584ec88.zip stroke-ba594c6d3192b048737952b248e6ee2b8584ec88.tar.bz2 |
Use specific Local.US for date-time strings for protocol use.
Default Locale is unsafe as one could, for example, get Arabic numerals
instead of ASCII ones.
Change-Id: Ib70d271bf433c4928accca3b4802c3ba3cb2aa0e
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/isode/stroke/base/DateTime.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/com/isode/stroke/base/DateTime.java b/src/com/isode/stroke/base/DateTime.java index 27c85d8..5f22cc3 100644 --- a/src/com/isode/stroke/base/DateTime.java +++ b/src/com/isode/stroke/base/DateTime.java @@ -13,11 +13,12 @@ package com.isode.stroke.base; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.Locale; import java.util.TimeZone; public class DateTime { public static Date stringToDate(String date) { - SimpleDateFormat parser = new SimpleDateFormat(format); + SimpleDateFormat parser = new SimpleDateFormat(format, Locale.US); parser.setTimeZone(TimeZone.getTimeZone("UTC")); try { return parser.parse(date); @@ -27,7 +28,7 @@ public class DateTime { } public static String dateToString(Date date) { - SimpleDateFormat parser = new SimpleDateFormat(format); + SimpleDateFormat parser = new SimpleDateFormat(format, Locale.US); parser.setTimeZone(TimeZone.getTimeZone("UTC")); return parser.format(date); } |