Parse podcast duration correctly even with trailing whitespace

The Skeptoid podcast (available on gpodder.net) currently has a specific
episode (titled "Skeptoid #437: Tube Amplifiers") that contains the XML
<itunes:duration>14:57 </itunes:duration> which AntennaPod fails
to parse (and instead hits a java.lang.NumberFormatException which
it prints to stderr every time the refresh button is pressed).
The duration for that particular episode is not correctly showed in
the UI, although the duration for other Skeptoid episodes show up
just fine.
This commit is contained in:
Martin Olsson 2014-12-02 23:51:36 +01:00
parent 1173b67049
commit 4dd97c6cca
1 changed files with 1 additions and 1 deletions

View File

@ -50,7 +50,7 @@ public class NSITunes extends Namespace {
if (localName.equals(AUTHOR)) {
state.getFeed().setAuthor(state.getContentBuf().toString());
} else if (localName.equals(DURATION)) {
String[] parts = state.getContentBuf().toString().split(":");
String[] parts = state.getContentBuf().toString().trim().split(":");
try {
int duration = 0;
if (parts.length == 2) {