diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2014-12-08 11:04:33 +0100 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2014-12-08 11:04:33 +0100 |
commit | 72d1bce2830126f465533a191eb15b853bf19aae (patch) | |
tree | 5de5b9380568426be131d054c30452c2cfd8e3f7 /core/src/main/java | |
parent | b147c837319f0f1baa4c40b22a86a81f91113fd0 (diff) | |
download | AntennaPod-72d1bce2830126f465533a191eb15b853bf19aae.zip |
Bugfix: Seconds in RFC822 are optional
fixes #545
Diffstat (limited to 'core/src/main/java')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/syndication/util/SyndDateUtils.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/util/SyndDateUtils.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/util/SyndDateUtils.java index 72e0f053b..1ac389f08 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/util/SyndDateUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/util/SyndDateUtils.java @@ -7,13 +7,16 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; +import de.danoeh.antennapod.core.BuildConfig; + /** * Parses several date formats. */ public class SyndDateUtils { private static final String TAG = "DateUtils"; - private static final String[] RFC822DATES = {"dd MMM yy HH:mm:ss Z",}; + private static final String[] RFC822DATES = {"dd MMM yy HH:mm:ss Z", + "dd MMM yy HH:mm Z"}; /** * RFC 3339 date format for UTC dates. @@ -51,17 +54,18 @@ public class SyndDateUtils { date = date.substring(date.indexOf(",") + 1).trim(); } SimpleDateFormat format = RFC822Formatter.get(); - for (int i = 0; i < RFC822DATES.length; i++) { + + for (String RFC822DATE : RFC822DATES) { try { - format.applyPattern(RFC822DATES[i]); + format.applyPattern(RFC822DATE); result = format.parse(date); break; } catch (ParseException e) { - e.printStackTrace(); + if (BuildConfig.DEBUG) Log.d(TAG, "ParserException", e); } } if (result == null) { - Log.e(TAG, "Unable to parse feed date correctly"); + Log.e(TAG, "Unable to parse feed date correctly:" + date); } return result; |