Catch NumberFormatException when parsing size attribute
This commit is contained in:
parent
0b0ea77df1
commit
aa3675bc83
|
@ -1,7 +1,7 @@
|
|||
package de.danoeh.antennapod.syndication.namespace.atom;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
|
||||
import android.util.Log;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.feed.FeedImage;
|
||||
import de.danoeh.antennapod.feed.FeedItem;
|
||||
import de.danoeh.antennapod.feed.FeedMedia;
|
||||
|
@ -11,6 +11,7 @@ import de.danoeh.antennapod.syndication.namespace.Namespace;
|
|||
import de.danoeh.antennapod.syndication.namespace.SyndElement;
|
||||
import de.danoeh.antennapod.syndication.util.SyndDateUtils;
|
||||
import de.danoeh.antennapod.syndication.util.SyndTypeUtils;
|
||||
import org.xml.sax.Attributes;
|
||||
|
||||
public class NSAtom extends Namespace {
|
||||
private static final String TAG = "NSAtom";
|
||||
|
@ -49,7 +50,9 @@ public class NSAtom extends Namespace {
|
|||
|
||||
private static final String LINK_TYPE_RSS = "application/rss+xml";
|
||||
|
||||
/** Regexp to test whether an Element is a Text Element. */
|
||||
/**
|
||||
* Regexp to test whether an Element is a Text Element.
|
||||
*/
|
||||
private static final String isText = TITLE + "|" + CONTENT + "|" + "|"
|
||||
+ SUBTITLE;
|
||||
|
||||
|
@ -76,8 +79,13 @@ public class NSAtom extends Namespace {
|
|||
} else if (rel.equals(LINK_REL_ENCLOSURE)) {
|
||||
String strSize = attributes.getValue(LINK_LENGTH);
|
||||
long size = 0;
|
||||
if (strSize != null)
|
||||
try {
|
||||
if (strSize != null) {
|
||||
size = Long.parseLong(strSize);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Length attribute could not be parsed.");
|
||||
}
|
||||
String type = attributes.getValue(LINK_TYPE);
|
||||
if (SyndTypeUtils.enclosureTypeValid(type)
|
||||
|| (type = SyndTypeUtils
|
||||
|
|
Loading…
Reference in New Issue