diff --git a/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java b/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java index 3d3c6d83a..c1f1396bf 100644 --- a/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java +++ b/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java @@ -33,7 +33,7 @@ public class SyndHandler extends DefaultHandler { public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { state.contentBuf = new StringBuffer(); - Namespace handler = getHandlingNamespace(uri); + Namespace handler = getHandlingNamespace(uri, qName); if (handler != null) { SyndElement element = handler.handleElementStart(localName, state, attributes); @@ -58,7 +58,7 @@ public class SyndHandler extends DefaultHandler { @Override public void endElement(String uri, String localName, String qName) throws SAXException { - Namespace handler = getHandlingNamespace(uri); + Namespace handler = getHandlingNamespace(uri, qName); if (handler != null) { handler.handleElementEnd(localName, state); state.tagstack.pop(); @@ -107,9 +107,9 @@ public class SyndHandler extends DefaultHandler { } } - private Namespace getHandlingNamespace(String uri) { + private Namespace getHandlingNamespace(String uri, String qName) { Namespace handler = state.namespaces.get(uri); - if (handler == null && !state.defaultNamespaces.empty()) { + if (handler == null && !state.defaultNamespaces.empty() && !qName.contains(":")) { handler = state.defaultNamespaces.peek(); } return handler; diff --git a/tests/src/de/danoeh/antennapod/test/FeedHandlerTest.java b/tests/src/de/danoeh/antennapod/test/FeedHandlerTest.java index 3803fa774..e924dbf5d 100644 --- a/tests/src/de/danoeh/antennapod/test/FeedHandlerTest.java +++ b/tests/src/de/danoeh/antennapod/test/FeedHandlerTest.java @@ -24,6 +24,7 @@ public class FeedHandlerTest extends AndroidTestCase { private static final String FEEDS_DIR = "testfeeds"; private static final String[] urls = { + "http://feeds.feedburner.com/buildanalyze", "http://www.blacksweetstories.com/feed/podcast/", "http://bitlove.org/ranzzeit/ranz/feed", "http://bitlove.org/importthis/mp3/feed", @@ -451,6 +452,14 @@ public class FeedHandlerTest extends AndroidTestCase { Log.e(TAG, "Feed has invalid items"); return false; } + if (feed.getLink() == null) { + Log.e(TAG, "Feed has no link"); + return false; + } + if (feed.getLink() != null && feed.getLink().length() == 0) { + Log.e(TAG, "Feed has empty link"); + return false; + } return true; } @@ -478,7 +487,7 @@ public class FeedHandlerTest extends AndroidTestCase { parseFeed(feed); feeds.remove(0); } - + Log.i(TAG, "RSS Test completed"); }