From ce0d14db42a87e3c788fa0e46d1a5550d3531e93 Mon Sep 17 00:00:00 2001 From: daniel oeh Date: Sat, 1 Sep 2012 13:27:41 +0200 Subject: [PATCH] Prevented namespace URIs from being added more than once --- .../syndication/handler/SyndHandler.java | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java b/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java index 4582aabba..b17b33094 100644 --- a/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java +++ b/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java @@ -77,28 +77,31 @@ public class SyndHandler extends DefaultHandler { public void startPrefixMapping(String prefix, String uri) throws SAXException { // Find the right namespace - if (uri.equals(NSAtom.NSURI)) { - if (prefix.equals(DEFAULT_PREFIX)) { - state.defaultNamespaces.push(new NSAtom()); - } else if (prefix.equals(NSAtom.NSTAG)) { - state.namespaces.put(uri, new NSAtom()); + if (!state.namespaces.containsKey(uri)) { + if (uri.equals(NSAtom.NSURI)) { + if (prefix.equals(DEFAULT_PREFIX)) { + state.defaultNamespaces.push(new NSAtom()); + } else if (prefix.equals(NSAtom.NSTAG)) { + state.namespaces.put(uri, new NSAtom()); + if (AppConfig.DEBUG) + Log.d(TAG, "Recognized Atom namespace"); + } + } else if (uri.equals(NSContent.NSURI) + && prefix.equals(NSContent.NSTAG)) { + state.namespaces.put(uri, new NSContent()); if (AppConfig.DEBUG) - Log.d(TAG, "Recognized Atom namespace"); + Log.d(TAG, "Recognized Content namespace"); + } else if (uri.equals(NSITunes.NSURI) + && prefix.equals(NSITunes.NSTAG)) { + state.namespaces.put(uri, new NSITunes()); + if (AppConfig.DEBUG) + Log.d(TAG, "Recognized ITunes namespace"); + } else if (uri.equals(NSSimpleChapters.NSURI) + && prefix.equals(NSSimpleChapters.NSTAG)) { + state.namespaces.put(uri, new NSSimpleChapters()); + if (AppConfig.DEBUG) + Log.d(TAG, "Recognized SimpleChapters namespace"); } - } else if (uri.equals(NSContent.NSURI) - && prefix.equals(NSContent.NSTAG)) { - state.namespaces.put(uri, new NSContent()); - if (AppConfig.DEBUG) - Log.d(TAG, "Recognized Content namespace"); - } else if (uri.equals(NSITunes.NSURI) && prefix.equals(NSITunes.NSTAG)) { - state.namespaces.put(uri, new NSITunes()); - if (AppConfig.DEBUG) - Log.d(TAG, "Recognized ITunes namespace"); - } else if (uri.equals(NSSimpleChapters.NSURI) - && prefix.equals(NSSimpleChapters.NSTAG)) { - state.namespaces.put(uri, new NSSimpleChapters()); - if (AppConfig.DEBUG) - Log.d(TAG, "Recognized SimpleChapters namespace"); } }