diff options
author | Tom Hennen <TomHennen@users.noreply.github.com> | 2015-06-25 19:02:13 -0400 |
---|---|---|
committer | Tom Hennen <TomHennen@users.noreply.github.com> | 2015-06-25 19:02:13 -0400 |
commit | 17814004b5943cdc61e03bf7bf2c452df89f1f4b (patch) | |
tree | 9d3d86e8abf92f2d2a826c14ee63f436c34cf486 | |
parent | 767c025c6b5b36d7ed7e06ab54661489389cf47c (diff) | |
parent | bf3ef27b384162cfe55694937b7d8e0c0e109dfc (diff) | |
download | AntennaPod-17814004b5943cdc61e03bf7bf2c452df89f1f4b.zip |
Merge pull request #953 from mfietz/issue/946-cache-simpledateformat
Cache DateTime parser
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java index 10512dd48..7b06128f9 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java @@ -16,6 +16,11 @@ public class DateUtils { private static final String TAG = "DateUtils"; + private static final SimpleDateFormat parser = new SimpleDateFormat("", Locale.US); + static { + parser.setLenient(false); + } + public static Date parse(final String input) { if(input == null) { throw new IllegalArgumentException("Date most not be null"); @@ -61,8 +66,7 @@ public class DateUtils { "yyyy-MM-ddZ", "yyyy-MM-dd" }; - SimpleDateFormat parser = new SimpleDateFormat("", Locale.US); - parser.setLenient(false); + ParsePosition pos = new ParsePosition(0); for(String pattern : patterns) { parser.applyPattern(pattern); |