/* (non-Javadoc) * @see java.lang.Thread#run() */ @SuppressWarnings("unchecked") @Override public void run() { while (!plugin.isSuspendThread()) { try { Thread.sleep(plugin.getConfiguration().getRefreshInterval() * 1000); } catch (InterruptedException e) { // ignore exception } for (final URL feedURL : plugin.getConfiguration().getFeedURLs()) { try { final SyndFeed feed = input.build(new XmlReader(feedURL)); for (final SyndEntry feedEntry : (List<SyndEntry>) feed.getEntries()) { plugin.addContent( feedEntry.getTitle(), feedEntry.getPublishedDate(), new URL(feedEntry.getLink())); } } catch (IllegalArgumentException e) { plugin.addException(new PluginException(plugin.getConfiguration(), e)); } catch (IOException e) { plugin.addException(new PluginException(plugin.getConfiguration(), e)); } catch (FeedException e) { plugin.addException(new PluginException(plugin.getConfiguration(), e)); } } } }
private List<SyndEntry> entriesForFeed(String xml) { ArrayList<SyndEntry> entries = new ArrayList<SyndEntry>(); XmlReader reader = this.xmlReaderForFeed(xml); if (reader != null) { try { SyndFeed feed = new SyndFeedInput().build(reader); for (Iterator i = feed.getEntries().iterator(); i.hasNext(); ) { entries.add((SyndEntry) i.next()); } } catch (Exception exception) { exception.printStackTrace(); } finally { if (reader != null) { try { reader.close(); } catch (IOException ioException) { ioException.printStackTrace(); } } } } return entries; }