From: <dam...@us...> - 2006-09-11 12:57:41
|
Revision: 1024 http://svn.sourceforge.net/azsmrc/?rev=1024&view=rev Author: damokles Date: 2006-09-11 05:57:30 -0700 (Mon, 11 Sep 2006) Log Message: ----------- prevent double id Modified Paths: -------------- azsmrcplugins/trunk/lbms/plugins/scanerss/main/Filter.java azsmrcplugins/trunk/lbms/plugins/scanerss/main/RSSFeed.java azsmrcplugins/trunk/lbms/plugins/scanerss/main/RSSFeedManager.java Modified: azsmrcplugins/trunk/lbms/plugins/scanerss/main/Filter.java =================================================================== --- azsmrcplugins/trunk/lbms/plugins/scanerss/main/Filter.java 2006-09-08 16:42:49 UTC (rev 1023) +++ azsmrcplugins/trunk/lbms/plugins/scanerss/main/Filter.java 2006-09-11 12:57:30 UTC (rev 1024) @@ -307,4 +307,8 @@ public void removeFilterListener (FilterListener l) { listener.remove(l); } + + protected int generateNewID() { + return ++id; + } } Modified: azsmrcplugins/trunk/lbms/plugins/scanerss/main/RSSFeed.java =================================================================== --- azsmrcplugins/trunk/lbms/plugins/scanerss/main/RSSFeed.java 2006-09-08 16:42:49 UTC (rev 1023) +++ azsmrcplugins/trunk/lbms/plugins/scanerss/main/RSSFeed.java 2006-09-11 12:57:30 UTC (rev 1024) @@ -556,4 +556,8 @@ l.updated(this, newItems); } } + + protected int generateNewID() { + return ++id; + } } Modified: azsmrcplugins/trunk/lbms/plugins/scanerss/main/RSSFeedManager.java =================================================================== --- azsmrcplugins/trunk/lbms/plugins/scanerss/main/RSSFeedManager.java 2006-09-08 16:42:49 UTC (rev 1023) +++ azsmrcplugins/trunk/lbms/plugins/scanerss/main/RSSFeedManager.java 2006-09-11 12:57:30 UTC (rev 1024) @@ -203,6 +203,13 @@ public void addFeed (RSSFeed f) { f.setRSSFeedManager(this); + for (int i=0; i<feeds.size();i++) { + if (feeds.get(i).getId() == f.getId()) { + //prevent double id + f.generateNewID(); + i=0; + } + } feeds.add(f); Collections.sort(feeds); f.addListener(feedListener); @@ -219,6 +226,9 @@ public void addFilter (Filter f) { f.setRSSFeedManager(this); + while (filter.containsKey(f.getId())) { + f.generateNewID(); + } filter.put(f.getId(), f); for (RSSFeedManagerListener l:listeners) l.filterAdded(f); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |