package pnews.servlet;
import java.io.IOException;
-import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
}
private static SyndFeed getSyndFeed(String u) throws IllegalArgumentException, FeedException, MalformedURLException, IOException {
- InputStream is;
XmlReader r;
r = new XmlReader(new URL(u));
XmlReader.setDefaultEncoding("UTF-8");
- return new SyndFeedInput().build(r);
-
+ return new SyndFeedInput().build(r);
}
private static Map<Category, String[]> getFeeds() {
result.put(Category.ESSONNE,
new String[] { "http://www.tourisme-essonne.com/rss/actus/",
- "http://www.ville-palaiseau.fr/rss/actualites.htm"
- /*"https://www.essonneinfo.fr/feed/"*/ });
+ "http://www.ville-palaiseau.fr/rss/actualites.htm" });
result.put(Category.PEOPLE,
new String[] { "http://www.premiere.fr/rss/actu-live",
LOG.severe("No feed for category " + cat);
}
+ /**
+ * Returns a copy.
+ */
public List<Article> getArticles(Category cat)
throws IllegalArgumentException, MalformedURLException, FeedException, IOException {
synchronized (articlesByCategory) {
- return articlesByCategory.get(cat);
+ return new ArrayList<>(articlesByCategory.get(cat));
}
}