From: Jean-Philippe Orsini Date: Mon, 16 Oct 2017 20:19:26 +0000 (+0200) Subject: fixed concurent exception when the list of articles is updated and requested X-Git-Url: http://git.wpitchoune.net/gitweb/?p=pnews.git;a=commitdiff_plain;h=d4dc04d702767d6f6f59eba4849814f6a76a3d62 fixed concurent exception when the list of articles is updated and requested --- diff --git a/war/src/main/java/pnews/servlet/ArticleProvider.java b/war/src/main/java/pnews/servlet/ArticleProvider.java index 4912469..55e098a 100644 --- a/war/src/main/java/pnews/servlet/ArticleProvider.java +++ b/war/src/main/java/pnews/servlet/ArticleProvider.java @@ -45,8 +45,7 @@ public class ArticleProvider { r = new XmlReader(new URL(u)); XmlReader.setDefaultEncoding("UTF-8"); - return new SyndFeedInput().build(r); - + return new SyndFeedInput().build(r); } private static Map getFeeds() { @@ -198,10 +197,13 @@ public class ArticleProvider { LOG.severe("No feed for category " + cat); } + /** + * Returns a copy. + */ public List
getArticles(Category cat) throws IllegalArgumentException, MalformedURLException, FeedException, IOException { synchronized (articlesByCategory) { - return articlesByCategory.get(cat); + return new ArrayList<>(articlesByCategory.get(cat)); } }