Merge pull request #2754 from AntennaPod/bugfix/2749-parse-error

Assume version 2.0 for RSS if property is missing
This commit is contained in:
H. Lehmann 2018-07-09 12:43:25 +02:00 committed by GitHub
commit eff72db7c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,19 +54,19 @@ public class TypeGetter {
return Type.ATOM; return Type.ATOM;
case RSS_ROOT: case RSS_ROOT:
String strVersion = xpp.getAttributeValue(null, "version"); String strVersion = xpp.getAttributeValue(null, "version");
if (strVersion != null) { if (strVersion == null) {
if (strVersion.equals("2.0")) { feed.setType(Feed.TYPE_RSS2);
feed.setType(Feed.TYPE_RSS2); Log.d(TAG, "Assuming type RSS 2.0");
Log.d(TAG, "Recognized type RSS 2.0"); return Type.RSS20;
return Type.RSS20; } else if (strVersion.equals("2.0")) {
} else if (strVersion.equals("0.91") feed.setType(Feed.TYPE_RSS2);
|| strVersion.equals("0.92")) { Log.d(TAG, "Recognized type RSS 2.0");
Log.d(TAG, "Recognized type RSS 0.91/0.92"); return Type.RSS20;
return Type.RSS091; } else if (strVersion.equals("0.91") || strVersion.equals("0.92")) {
} Log.d(TAG, "Recognized type RSS 0.91/0.92");
throw new UnsupportedFeedtypeException("Unsupported rss version"); return Type.RSS091;
} }
throw new UnsupportedFeedtypeException("No rss version attribute found"); throw new UnsupportedFeedtypeException("Unsupported rss version");
default: default:
Log.d(TAG, "Type is invalid"); Log.d(TAG, "Type is invalid");
throw new UnsupportedFeedtypeException(Type.INVALID, tag); throw new UnsupportedFeedtypeException(Type.INVALID, tag);