roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gma...@apache.org
Subject svn commit: r1555104 - in /roller/trunk/app/src/main/java/org/apache/roller: planet/business/ planet/business/jpa/ weblogger/business/ weblogger/business/jpa/ weblogger/business/runnable/ weblogger/pojos/ weblogger/ui/core/util/menu/ weblogger/ui/rende...
Date Fri, 03 Jan 2014 14:16:28 GMT
Author: gmazza
Date: Fri Jan  3 14:16:28 2014
New Revision: 1555104

URL: http://svn.apache.org/r1555104
Log:
Removed more Iterators and converted more methods to parameterized types.

Modified:
    roller/trunk/app/src/main/java/org/apache/roller/planet/business/PlanetManager.java
    roller/trunk/app/src/main/java/org/apache/roller/planet/business/jpa/JPAPlanetManagerImpl.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/HitCountQueue.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/WeblogEntryManager.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/WeblogManager.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/runnable/HitCountProcessingJob.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/runnable/ScheduledEntriesTask.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/WeblogEntry.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/util/menu/MenuHelper.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/util/menu/ParsedMenu.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/util/menu/ParsedTab.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/PlanetModel.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/SiteModel.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/Blacklist.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/MailUtil.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/RollerMessages.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/URLUtilities.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/cache/CacheManager.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/webservices/adminprotocol/sdk/MemberEntrySet.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/webservices/adminprotocol/sdk/Service.java

Modified: roller/trunk/app/src/main/java/org/apache/roller/planet/business/PlanetManager.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/planet/business/PlanetManager.java?rev=1555104&r1=1555103&r2=1555104&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/planet/business/PlanetManager.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/planet/business/PlanetManager.java Fri Jan  3 14:16:28 2014
@@ -45,7 +45,7 @@ public interface PlanetManager extends M
     Planet getWebloggerById(String id) throws RollerException;
     
     
-    List getWebloggers() throws RollerException;
+    List<Planet> getWebloggers() throws RollerException;
     
     
     /**
@@ -96,7 +96,7 @@ public interface PlanetManager extends M
     /**
      * Get all subscriptions.
      */
-    List getSubscriptions() throws RollerException;
+    List<Subscription> getSubscriptions() throws RollerException;
     
     
     /**
@@ -108,13 +108,13 @@ public interface PlanetManager extends M
     /**
      * Get top X subscriptions.
      */
-    List getTopSubscriptions(int offset, int len) throws RollerException;
+    List<Subscription> getTopSubscriptions(int offset, int len) throws RollerException;
     
     
     /**
      * Get top X subscriptions, restricted by group.
      */
-    List getTopSubscriptions(PlanetGroup group, int offset, int len)
+    List<Subscription> getTopSubscriptions(PlanetGroup group, int offset, int len)
         throws RollerException;
     
     
@@ -148,23 +148,23 @@ public interface PlanetManager extends M
     /**
      * Get entries in a single feed as list of SubscriptionEntry objects.
      */
-    List getEntries(Subscription sub, int offset, int len)
+    List<SubscriptionEntry> getEntries(Subscription sub, int offset, int len)
         throws RollerException;
     
     
     /**
-     * Get Entries for a Group in reverse chonological order.
+     * Get Entries for a Group in reverse chronological order.
      *
      * @param group Restrict to entries from one group.
      * @param offset Offset into results (for paging)
      * @param len Maximum number of results to return (for paging)
      */
-    List getEntries(PlanetGroup group, int offset, int len)
+    List<SubscriptionEntry> getEntries(PlanetGroup group, int offset, int len)
         throws RollerException;
     
     
     /**
-     * Get Entries for a Group in reverse chonological order, optionally 
+     * Get Entries for a Group in reverse chronological order, optionally
      * constrained to a certain timeframe.
      *
      * @param group Restrict to entries from one group.
@@ -173,7 +173,7 @@ public interface PlanetManager extends M
      * @param offset Offset into results (for paging)
      * @param len Maximum number of results to return (for paging)
      */
-    List getEntries(PlanetGroup group,
+    List<SubscriptionEntry> getEntries(PlanetGroup group,
                            Date startDate, 
                            Date endDate,
                            int offset, 

Modified: roller/trunk/app/src/main/java/org/apache/roller/planet/business/jpa/JPAPlanetManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/planet/business/jpa/JPAPlanetManagerImpl.java?rev=1555104&r1=1555103&r2=1555104&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/planet/business/jpa/JPAPlanetManagerImpl.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/planet/business/jpa/JPAPlanetManagerImpl.java Fri Jan  3 14:16:28 2014
@@ -53,11 +53,7 @@ public class JPAPlanetManagerImpl extend
     
     /** The strategy for this manager. */
     private final JPAPersistenceStrategy strategy;
-    
-    protected Map lastUpdatedByGroup = new HashMap();
-    protected static final String NO_GROUP = "zzz_nogroup_zzz";
-    
-    
+
     @com.google.inject.Inject  
     protected JPAPlanetManagerImpl(JPAPersistenceStrategy strategy) {
         log.debug("Instantiating JPA Planet Manager");
@@ -129,7 +125,7 @@ public class JPAPlanetManagerImpl extend
         return q.getResultList().size();
     }
     
-    public List getTopSubscriptions(int offset, int length)
+    public List<Subscription> getTopSubscriptions(int offset, int length)
     throws RollerException {
         return getTopSubscriptions(null, offset, length);
     }
@@ -137,9 +133,9 @@ public class JPAPlanetManagerImpl extend
     /**
      * Get top X subscriptions, restricted by group.
      */
-    public List getTopSubscriptions(
+    public List<Subscription> getTopSubscriptions(
             PlanetGroup group, int offset, int len) throws RollerException {
-        List result = null;
+        List<Subscription> result;
         if (group != null) {
             Query q = strategy.getNamedQuery(
                     "Subscription.getByGroupOrderByInboundBlogsDesc");
@@ -200,11 +196,11 @@ public class JPAPlanetManagerImpl extend
         return (Planet)strategy.load(Planet.class, id);
     }
     
-    public List getWebloggers() throws RollerException {
-        return (List)strategy.getNamedQuery("Planet.getAll").getResultList();
+    public List<Planet> getWebloggers() throws RollerException {
+        return strategy.getNamedQuery("Planet.getAll").getResultList();
     }
     
-    public List getGroupHandles(Planet planet) throws RollerException {
+    public List<String> getGroupHandles(Planet planet) throws RollerException {
         List<String> handles = new ArrayList<String>();
         for (PlanetGroup group : getGroups(planet)) {
             handles.add(group.getHandle());
@@ -242,7 +238,7 @@ public class JPAPlanetManagerImpl extend
         sub.getEntries().clear();
     }
     
-    public List getSubscriptions() throws RollerException {
+    public List<Subscription> getSubscriptions() throws RollerException {
         Query q = strategy.getNamedQuery("Subscription.getAllOrderByFeedURL");
         return q.getResultList();
     }
@@ -251,7 +247,7 @@ public class JPAPlanetManagerImpl extend
         return (SubscriptionEntry) strategy.load(SubscriptionEntry.class, id);
     }
 
-    public List getEntries(Subscription sub, int offset, int len) throws RollerException {            
+    public List<SubscriptionEntry> getEntries(Subscription sub, int offset, int len) throws RollerException {
         if (sub == null) {
             throw new WebloggerException("subscription cannot be null");
         }
@@ -266,17 +262,17 @@ public class JPAPlanetManagerImpl extend
         return q.getResultList();
     }
 
-    public List getEntries(PlanetGroup group, int offset, int len) throws RollerException {
+    public List<SubscriptionEntry> getEntries(PlanetGroup group, int offset, int len) throws RollerException {
         return getEntries(group, null, null, offset, len);
     }
 
-    public List getEntries(PlanetGroup group, Date startDate, Date endDate, int offset, int len) throws RollerException {
+    public List<SubscriptionEntry> getEntries(PlanetGroup group, Date startDate, Date endDate, int offset, int len) throws RollerException {
 
         if (group == null) {
             throw new WebloggerException("group cannot be null or empty");
         }
         
-        List ret = null;
+        List<SubscriptionEntry> ret = null;
         try {
             long startTime = System.currentTimeMillis();
             

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/HitCountQueue.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/HitCountQueue.java?rev=1555104&r1=1555103&r2=1555104&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/HitCountQueue.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/HitCountQueue.java Fri Jan  3 14:16:28 2014
@@ -49,7 +49,7 @@ public class HitCountQueue {
     private int numWorkers = 1;
     private int sleepTime = 180000;
     private WorkerThread worker = null;
-    private List queue = null;
+    private List<String> queue = null;
     
     
     static {
@@ -70,7 +70,7 @@ public class HitCountQueue {
         }
         
         // create the hits queue
-        this.queue = Collections.synchronizedList(new ArrayList());
+        this.queue = Collections.synchronizedList(new ArrayList<String>());
         
         // start up a worker to process the hits at intervals
         HitCountProcessingJob job = new HitCountProcessingJob();
@@ -94,8 +94,8 @@ public class HitCountQueue {
     }
     
     
-    public List getHits() {
-        return new ArrayList(this.queue);
+    public List<String> getHits() {
+        return new ArrayList<String>(this.queue);
     }
     
     
@@ -103,7 +103,7 @@ public class HitCountQueue {
      * Reset the queued hits.
      */
     public synchronized void resetHits() {
-        this.queue = Collections.synchronizedList(new ArrayList());
+        this.queue = Collections.synchronizedList(new ArrayList<String>());
     }
     
     

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/WeblogEntryManager.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/WeblogEntryManager.java?rev=1555104&r1=1555103&r2=1555104&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/WeblogEntryManager.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/WeblogEntryManager.java Fri Jan  3 14:16:28 2014
@@ -149,7 +149,6 @@ public interface WeblogEntryManager {
      * Get weblog entries with given category or, optionally, any sub-category
      * of that category.
      * @param cat     Category
-     * @param publishedOnly True to retrieve published articles only
      * @return        List of weblog entries in category
      */
     List<WeblogEntry> getWeblogEntries(WeblogCategory cat, boolean subcats)
@@ -194,9 +193,9 @@ public interface WeblogEntryManager {
     /**
      * Get specified number of most recent pinned and published Weblog Entries.
      * @param max Maximum number to return.
-     * @return Collection of WeblogEntryData objects.
+     * @return Collection of WeblogEntry objects.
      */
-    List getWeblogEntriesPinnedToMain(Integer max) throws WebloggerException;
+    List<WeblogEntry> getWeblogEntriesPinnedToMain(Integer max) throws WebloggerException;
 
     /**
      * Remove attribute with given name from given WeblogEntryData
@@ -283,7 +282,7 @@ public interface WeblogEntryManager {
      * @param offset     Offset into results for paging
      * @param length     Max comments to return (or -1 for no limit)
      */
-    List getComments(
+    List<WeblogEntryComment> getComments(
             
             Weblog          website,
             WeblogEntry     entry,
@@ -436,7 +435,7 @@ public interface WeblogEntryManager {
      * @return The list of HitCountData objects ranked by hit count, descending.
      * @throws WebloggerException If there was a problem with the backend.
      */
-    List getHotWeblogs(int sinceDays, int offset, int length)
+    List<WeblogHitCount> getHotWeblogs(int sinceDays, int offset, int length)
         throws WebloggerException;
     
     

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/WeblogManager.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/WeblogManager.java?rev=1555104&r1=1555103&r2=1555104&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/WeblogManager.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/WeblogManager.java Fri Jan  3 14:16:28 2014
@@ -22,6 +22,7 @@ import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import org.apache.roller.weblogger.WebloggerException;
+import org.apache.roller.weblogger.pojos.StatCount;
 import org.apache.roller.weblogger.pojos.User;
 import org.apache.roller.weblogger.pojos.Weblog;
 import org.apache.roller.weblogger.pojos.WeblogTemplate;
@@ -90,9 +91,9 @@ public interface WeblogManager {
      * @param endDate   Restrict to those created before (or null for all)
      * @param offset    Offset into results (for paging)
      * @param length    Maximum number of results to return (for paging)
-     * @return List of WebsiteData objects.
+     * @return List of Weblog objects.
      */
-    List getWeblogs(
+    List<Weblog> getWeblogs(
             Boolean  enabled,
             Boolean  active,
             Date     startDate,
@@ -106,9 +107,9 @@ public interface WeblogManager {
      * Get websites of a user.
      * @param user        Get all weblogs for this user
      * @param enabledOnly Include only enabled weblogs?
-     * @return List of WebsiteData objects.
+     * @return List of Weblog objects.
      */
-    List getUserWeblogs(User user, boolean enabledOnly) throws WebloggerException;
+    List<Weblog> getUserWeblogs(User user, boolean enabledOnly) throws WebloggerException;
     
     
     /**
@@ -117,7 +118,7 @@ public interface WeblogManager {
      * @param enabledOnly Include only enabled users?
      * @return List of WebsiteData objects.
      */
-    List getWeblogUsers(Weblog weblog, boolean enabledOnly) throws WebloggerException;
+    List<User> getWeblogUsers(Weblog weblog, boolean enabledOnly) throws WebloggerException;
     
     
     /**
@@ -126,9 +127,9 @@ public interface WeblogManager {
      * @param endDate Restrict to those created before (or null for all)
      * @param offset    Offset into results (for paging)
      * @param len       Maximum number of results to return (for paging)
-     * @return List of WebsiteData objects.
+     * @return List of StatCount objects.
      */
-    List getMostCommentedWeblogs(
+    List<StatCount> getMostCommentedWeblogs(
             Date startDate,
             Date endDate,
             int  offset,
@@ -147,7 +148,7 @@ public interface WeblogManager {
     /** 
      * Get collection of weblogs whose handles begin with specified letter 
      */
-    List getWeblogsByLetter(char letter, int offset, int length)
+    List<Weblog> getWeblogsByLetter(char letter, int offset, int length)
         throws WebloggerException;
     
         /**

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java?rev=1555104&r1=1555103&r2=1555104&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java Fri Jan  3 14:16:28 2014
@@ -627,7 +627,7 @@ public class JPAWeblogEntryManagerImpl i
     /**
      * @inheritDoc
      */
-    public List getWeblogEntriesPinnedToMain(Integer max)
+    public List<WeblogEntry> getWeblogEntriesPinnedToMain(Integer max)
     throws WebloggerException {
         Query query = strategy.getNamedQuery(
                 "WeblogEntry.getByPinnedToMain&statusOrderByPubTimeDesc");
@@ -1523,7 +1523,7 @@ public class JPAWeblogEntryManagerImpl i
     /**
      * @inheritDoc
      */
-    public List getHotWeblogs(int sinceDays, int offset, int length)
+    public List<WeblogHitCount> getHotWeblogs(int sinceDays, int offset, int length)
     throws WebloggerException {
         
         // figure out start date

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java?rev=1555104&r1=1555103&r2=1555104&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java Fri Jan  3 14:16:28 2014
@@ -450,7 +450,7 @@ public class JPAWeblogManagerImpl implem
     /**
      * Get websites of a user
      */
-    public List getWeblogs(
+    public List<Weblog> getWeblogs(
             Boolean enabled, Boolean active,
             Date startDate, Date endDate, int offset, int length) throws WebloggerException {
         
@@ -532,8 +532,8 @@ public class JPAWeblogManagerImpl implem
         roller.getWeblogManager().saveWeblog(themeAssoc.getWeblog());
     }
         
-    public List getUserWeblogs(User user, boolean enabledOnly) throws WebloggerException {
-        List weblogs = new ArrayList();
+    public List<Weblog> getUserWeblogs(User user, boolean enabledOnly) throws WebloggerException {
+        List<Weblog> weblogs = new ArrayList<Weblog>();
         if (user == null) {
             return weblogs;
         }
@@ -549,8 +549,8 @@ public class JPAWeblogManagerImpl implem
         return weblogs;
     }
     
-    public List getWeblogUsers(Weblog weblog, boolean enabledOnly) throws WebloggerException {
-        List users = new ArrayList();
+    public List<User> getWeblogUsers(Weblog weblog, boolean enabledOnly) throws WebloggerException {
+        List<User> users = new ArrayList<User>();
         List<WeblogPermission> perms = roller.getUserManager().getWeblogPermissions(weblog);
         for (WeblogPermission perm : perms) {
             User user = perm.getUser();
@@ -668,7 +668,7 @@ public class JPAWeblogManagerImpl implem
     /**
      * @see org.apache.roller.weblogger.business.WeblogManager#getPages(Weblog)
      */
-    public List getPages(Weblog website) throws WebloggerException {
+    public List<Weblog> getPages(Weblog website) throws WebloggerException {
         if (website == null) {
             throw new WebloggerException("website is null");
         }
@@ -694,7 +694,7 @@ public class JPAWeblogManagerImpl implem
         return results;
     }
     
-    public List getWeblogsByLetter(char letter, int offset, int length)
+    public List<Weblog> getWeblogsByLetter(char letter, int offset, int length)
     throws WebloggerException {
         Query query = strategy.getNamedQuery(
                 "Weblog.getByLetterOrderByHandle");
@@ -708,7 +708,7 @@ public class JPAWeblogManagerImpl implem
         return query.getResultList();
     }
     
-    public List getMostCommentedWeblogs(Date startDate, Date endDate,
+    public List<StatCount> getMostCommentedWeblogs(Date startDate, Date endDate,
             int offset, int length)
             throws WebloggerException {
         
@@ -738,7 +738,7 @@ public class JPAWeblogManagerImpl implem
             query.setMaxResults(length);
         }
         List queryResults = query.getResultList();
-        List results = new ArrayList();
+        List<StatCount> results = new ArrayList<StatCount>();
         for (Iterator iter = queryResults.iterator(); iter.hasNext();) {
             Object[] row = (Object[]) iter.next();
             StatCount sc = new StatCount(

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/runnable/HitCountProcessingJob.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/runnable/HitCountProcessingJob.java?rev=1555104&r1=1555103&r2=1555104&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/runnable/HitCountProcessingJob.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/runnable/HitCountProcessingJob.java Fri Jan  3 14:16:28 2014
@@ -19,7 +19,6 @@
 package org.apache.roller.weblogger.business.runnable;
 
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import org.apache.commons.logging.Log;
@@ -27,7 +26,6 @@ import org.apache.commons.logging.LogFac
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.HitCountQueue;
 import org.apache.roller.weblogger.business.WebloggerFactory;
-import org.apache.roller.weblogger.business.UserManager;
 import org.apache.roller.weblogger.business.WeblogEntryManager;
 import org.apache.roller.weblogger.business.WeblogManager;
 import org.apache.roller.weblogger.pojos.Weblog;
@@ -53,25 +51,21 @@ public class HitCountProcessingJob imple
      */
     public void execute() {
         
-        UserManager umgr = WebloggerFactory.getWeblogger().getUserManager();
         WeblogManager wmgr = WebloggerFactory.getWeblogger().getWeblogManager();
         WeblogEntryManager emgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
         
         HitCountQueue hitCounter = HitCountQueue.getInstance();
         
         // first get the current set of hits
-        List currentHits = hitCounter.getHits();
+        List<String> currentHits = hitCounter.getHits();
         
         // now reset the queued hits
         hitCounter.resetHits();
         
         // tally the counts, grouped by weblog handle
-        Map hitsTally = new HashMap();
-        String weblogHandle = null;
-        for(int i=0; i < currentHits.size(); i++) {
-            weblogHandle = (String) currentHits.get(i);
-            
-            Long count = (Long) hitsTally.get(weblogHandle);
+        Map<String, Long> hitsTally = new HashMap<String, Long>();
+        for (String weblogHandle : currentHits) {
+            Long count = hitsTally.get(weblogHandle);
             if(count == null) {
                 count = 1L;
             } else {
@@ -79,25 +73,21 @@ public class HitCountProcessingJob imple
             }
             hitsTally.put(weblogHandle, count);
         }
-        
+
         // iterate over the tallied hits and store them in the db
         try {
             long startTime = System.currentTimeMillis();
             
-            Weblog weblog = null;
-            String key = null;
-            Iterator it = hitsTally.keySet().iterator();
-            while(it.hasNext()) {
-                key = (String) it.next();
-                
+            Weblog weblog;
+            for (String key : hitsTally.keySet()) {
                 try {
                     weblog = wmgr.getWeblogByHandle(key);
-                    emgr.incrementHitCount(weblog, ((Long)hitsTally.get(key)).intValue());
+                    emgr.incrementHitCount(weblog, (hitsTally.get(key)).intValue());
                 } catch (WebloggerException ex) {
                     log.error(ex);
                 }
             }
-            
+
             // flush the results to the db
             WebloggerFactory.getWeblogger().flush();
             

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/runnable/ScheduledEntriesTask.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/runnable/ScheduledEntriesTask.java?rev=1555104&r1=1555103&r2=1555104&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/runnable/ScheduledEntriesTask.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/runnable/ScheduledEntriesTask.java Fri Jan  3 14:16:28 2014
@@ -19,7 +19,6 @@
 package org.apache.roller.weblogger.business.runnable;
 
 import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
 import org.apache.commons.logging.Log;
@@ -138,7 +137,7 @@ public class ScheduledEntriesTask extend
             log.debug("looking up scheduled entries older than "+now);
             
             // get all published entries older than current time
-            List scheduledEntries = wMgr.getWeblogEntries(
+            List<WeblogEntry> scheduledEntries = wMgr.getWeblogEntries(
                     
                     null,   // website
                     null,   // user
@@ -154,32 +153,23 @@ public class ScheduledEntriesTask extend
                     
             log.debug("promoting "+scheduledEntries.size()+" entries to PUBLISHED state");
             
-            WeblogEntry entry = null;
-            Iterator it = scheduledEntries.iterator();
-            while(it.hasNext()) {
-                entry = (WeblogEntry) it.next();
-                
-                // update status to PUBLISHED and save
+            for (WeblogEntry entry : scheduledEntries) {
                 entry.setStatus(WeblogEntry.PUBLISHED);
                 wMgr.saveWeblogEntry(entry);
             }
-            
+
             // commit the changes
             WebloggerFactory.getWeblogger().flush();
             
             // take a second pass to trigger reindexing and cache invalidations
             // this is because we need the updated entries flushed first
-            it = scheduledEntries.iterator();
-            while(it.hasNext()) {
-                entry = (WeblogEntry) it.next();
-                
+            for (WeblogEntry entry : scheduledEntries) {
                 // trigger a cache invalidation
                 CacheManager.invalidate(entry);
-                
                 // trigger search index on entry
                 searchMgr.addEntryReIndexOperation(entry);
             }
-            
+
         } catch (WebloggerException e) {
             log.error("Error getting scheduled entries", e);
         } catch(Exception e) {

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/WeblogEntry.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/WeblogEntry.java?rev=1555104&r1=1555103&r2=1555104&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/WeblogEntry.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/WeblogEntry.java Fri Jan  3 14:16:28 2014
@@ -743,15 +743,15 @@ public class WeblogEntry implements Seri
     
     //------------------------------------------------------------------------
     
-    public List getComments() {
+    public List<WeblogEntryComment> getComments() {
         return getComments(true, true);
     }
     
     /**
      * TODO: why is this method exposed to users with ability to get spam/non-approved comments?
      */
-    public List getComments(boolean ignoreSpam, boolean approvedOnly) {
-        List list = new ArrayList();
+    public List<WeblogEntryComment> getComments(boolean ignoreSpam, boolean approvedOnly) {
+        List<WeblogEntryComment> list = new ArrayList<WeblogEntryComment>();
         try {
             WeblogEntryManager wmgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
             return wmgr.getComments(

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/util/menu/MenuHelper.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/util/menu/MenuHelper.java?rev=1555104&r1=1555103&r2=1555104&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/util/menu/MenuHelper.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/util/menu/MenuHelper.java Fri Jan  3 14:16:28 2014
@@ -21,7 +21,6 @@ package org.apache.roller.weblogger.ui.c
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Hashtable;
-import java.util.Iterator;
 import java.util.List;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -105,13 +104,9 @@ public class MenuHelper {
         UserManager umgr = WebloggerFactory.getWeblogger().getUserManager();
         
         // iterate over tabs from parsed config
-        ParsedTab configTab = null;
-        Iterator tabsIter = menuConfig.getTabs().iterator();
-        while (tabsIter.hasNext()) {
-            configTab = (ParsedTab) tabsIter.next();
-            
-            log.debug("config tab = "+configTab.getName());
-            
+        for (ParsedTab configTab : menuConfig.getTabs()) {
+            log.debug("config tab = " + configTab.getName());
+
             // does this tab have an enabledProperty?
             boolean includeTab = true;
             if(configTab.getEnabledProperty() != null) {
@@ -119,7 +114,7 @@ public class MenuHelper {
             } else if(configTab.getDisabledProperty() != null) {
                 includeTab = ! getBooleanProperty(configTab.getDisabledProperty());
             }
-            
+
             // user roles check
             if (includeTab && configTab.getGlobalPermissionActions() != null
                     && !configTab.getGlobalPermissionActions().isEmpty()) {
@@ -145,20 +140,17 @@ public class MenuHelper {
 
             if (includeTab) {
                 log.debug("tab allowed - "+configTab.getName());
-                
+
                 // all checks passed, tab should be included
                 MenuTab tab = new MenuTab();
                 tab.setKey(configTab.getName());
-                
+
                 // setup tab items
                 boolean firstItem = true;
-                ParsedTabItem configTabItem = null;
-                Iterator itemsIter = configTab.getTabItems().iterator();
-                while (itemsIter.hasNext()) {
-                    configTabItem = (ParsedTabItem) itemsIter.next();
-                    
+                for (ParsedTabItem configTabItem : configTab.getTabItems()) {
+
                     log.debug("config tab item = "+configTabItem.getName());
-                    
+
                     boolean includeItem = true;
 
                     if (configTabItem.getEnabledProperty() != null) {
@@ -166,7 +158,7 @@ public class MenuHelper {
                     } else if (configTabItem.getDisabledProperty() != null) {
                         includeItem = ! getBooleanProperty(configTabItem.getDisabledProperty());
                     }
-                    
+
                     // user roles check
                     if (includeItem && configTabItem.getGlobalPermissionActions() != null
                             && !configTabItem.getGlobalPermissionActions().isEmpty()) {
@@ -186,34 +178,34 @@ public class MenuHelper {
 
                     if (includeItem) {
                         log.debug("tab item allowed - "+configTabItem.getName());
-                        
+
                         // all checks passed, item should be included
                         MenuTabItem tabItem = new MenuTabItem();
                         tabItem.setKey(configTabItem.getName());
                         tabItem.setAction(configTabItem.getAction());
-                        
+
                         // is this the selected item?
                         if (isSelected(currentAction, configTabItem)) {
                             tabItem.setSelected(true);
                             tab.setSelected(true);
                         }
-                        
+
                         // the url for the tab is the url of the first item of the tab
                         if (firstItem) {
                             tab.setAction(tabItem.getAction());
                             firstItem = false;
                         }
-                        
+
                         // add the item
                         tab.addItem(tabItem);
                     }
                 }
-                
+
                 // add the tab
                 tabMenu.addTab(tab);
             }
         }
-        
+
         return tabMenu;
     }    
     
@@ -231,11 +223,11 @@ public class MenuHelper {
             return true;
         }
         
-        // an item is also considered selected if it's subforwards are the current action
+        // an item is also considered selected if its subforwards are the current action
         String[] subActions = tabItem.getSubActions();
-        if (subActions != null && subActions.length > 0) {
-            for(int i=0; i < subActions.length; i++) {
-                if (currentAction.equals(subActions[i])) {
+        if (subActions != null) {
+            for (String subAction : subActions) {
+                if (currentAction.equals(subAction)) {
                     return true;
                 }
             }
@@ -262,13 +254,11 @@ public class MenuHelper {
         Document doc = builder.build(instream);
         
         Element root = doc.getRootElement();
-        List parsedMenus = root.getChildren("menu");
-        Iterator iter = parsedMenus.iterator();
-        while (iter.hasNext()) {
-            Element e = (Element) iter.next();
+        List<Element> parsedMenus = root.getChildren("menu");
+        for (Element e : parsedMenus) {
             config.addTab(elementToParsedTab(e));
         }
-        
+
         return config;
     }
     
@@ -287,13 +277,11 @@ public class MenuHelper {
         tab.setEnabledProperty(element.getAttributeValue("enabledProperty"));
         tab.setDisabledProperty(element.getAttributeValue("disabledProperty"));
         
-        List menuItems = element.getChildren("menu-item");
-        Iterator iter = menuItems.iterator();
-        while (iter.hasNext()) {
-            Element e = (Element) iter.next();
+        List<Element> menuItems = element.getChildren("menu-item");
+        for (Element e : menuItems) {
             tab.addItem(elementToParsedTabItem(e));
         }
-        
+
         return tab;
     }
     

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/util/menu/ParsedMenu.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/util/menu/ParsedMenu.java?rev=1555104&r1=1555103&r2=1555104&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/util/menu/ParsedMenu.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/util/menu/ParsedMenu.java Fri Jan  3 14:16:28 2014
@@ -27,19 +27,17 @@ import java.util.List;
  */
 public class ParsedMenu {
     
-    private List tabs = new ArrayList();
-    
+    private List<ParsedTab> tabs = new ArrayList<ParsedTab>();
     
     public void addTab(ParsedTab tab) {
         this.tabs.add(tab);
     }
-    
-    
-    public List getTabs() {
+
+    public List<ParsedTab> getTabs() {
         return tabs;
     }
 
-    public void setTabs(List tabs) {
+    public void setTabs(List<ParsedTab> tabs) {
         this.tabs = tabs;
     }
     

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/util/menu/ParsedTab.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/util/menu/ParsedTab.java?rev=1555104&r1=1555103&r2=1555104&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/util/menu/ParsedTab.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/util/menu/ParsedTab.java Fri Jan  3 14:16:28 2014
@@ -33,14 +33,12 @@ public class ParsedTab {
     private String enabledProperty = null;
     private String disabledProperty = null;
     
-    private List tabItems = new ArrayList();
-    
+    private List<ParsedTabItem> tabItems = new ArrayList<ParsedTabItem>();
     
     public void addItem(ParsedTabItem item) {
         this.tabItems.add(item);
     }
-    
-    
+
     public String getName() {
         return name;
     }
@@ -73,11 +71,11 @@ public class ParsedTab {
         this.enabledProperty = enabledProperty;
     }
 
-    public List getTabItems() {
+    public List<ParsedTabItem> getTabItems() {
         return tabItems;
     }
 
-    public void setTabItems(List tabItems) {
+    public void setTabItems(List<ParsedTabItem> tabItems) {
         this.tabItems = tabItems;
     }
 

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/PlanetModel.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/PlanetModel.java?rev=1555104&r1=1555103&r2=1555104&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/PlanetModel.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/PlanetModel.java Fri Jan  3 14:16:28 2014
@@ -19,7 +19,6 @@
 package org.apache.roller.weblogger.ui.rendering.model;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -96,8 +95,7 @@ public class PlanetModel implements Mode
     /**
      * Get pager for PlanetEntry objects from 'all' and
      * 'exernal' Planet groups. in reverse chrono order.
-     * @param offset   Offset into results (for paging)
-     * @param len      Max number of results to return
+     * @param length      Max number of results to return
      */
     public Pager getAggregationPager(int sinceDays, int length) {
         
@@ -120,8 +118,7 @@ public class PlanetModel implements Mode
     /**
      * Get pager for WeblogEntry objects from specified
      * Planet groups in reverse chrono order.
-     * @param offset   Offset into results (for paging)
-     * @param len      Max number of results to return
+     * @param length      Max number of results to return
      */
     public Pager getAggregationPager(String groupHandle, int sinceDays, int length) {
         
@@ -144,8 +141,7 @@ public class PlanetModel implements Mode
     /**
      * Get pager for WeblogEntry objects from specified
      * Planet feed in reverse chrono order.
-     * @param offset   Offset into results (for paging)
-     * @param len      Max number of results to return
+     * @param length      Max number of results to return
      */
     public Pager getFeedPager(String feedURL, int length) {
         
@@ -168,10 +164,9 @@ public class PlanetModel implements Mode
     /**
      * Get PlanetSubscription objects in descending order by Planet ranking.
      * @param sinceDays Only consider weblogs updated in the last sinceDays
-     * @param offset   Offset into results (for paging)
-     * @param len      Max number of results to return
+     * @param length      Max number of results to return
      */
-    public List getRankedSubscriptions(int sinceDays, int length) {
+    public List<Subscription> getRankedSubscriptions(int sinceDays, int length) {
         return getRankedSubscriptions(null, sinceDays, length);
     }
     
@@ -180,20 +175,18 @@ public class PlanetModel implements Mode
      * Get PlanetSubscription objects in descending order by Planet ranking.
      * @param groupHandle Only consider weblogs updated in the last sinceDays
      * @param sinceDays   Only consider weblogs updated in the last sinceDays
-     * @param offset      Offset into results (for paging)
-     * @param len         Max number of results to return
+     * @param length         Max number of results to return
      */
-    public List getRankedSubscriptions(String groupHandle, int sinceDays, int length) {
-        List list = new ArrayList();
+    public List<Subscription> getRankedSubscriptions(String groupHandle, int sinceDays, int length) {
+        List<Subscription> list = new ArrayList<Subscription>();
         try {
             PlanetManager planetManager = WebloggerFactory.getWeblogger().getPlanetManager();
             Planet defaultPlanet = planetManager.getWeblogger(DEFAULT_PLANET_HANDLE);
             PlanetGroup planetGroup = planetManager.getGroup(defaultPlanet, groupHandle);
-            List subs = planetManager.getTopSubscriptions(planetGroup, 0, length);
-            for (Iterator it = subs.iterator(); it.hasNext();) {
-                Subscription sub = (Subscription) it.next();
+            List<Subscription> subs = planetManager.getTopSubscriptions(planetGroup, 0, length);
+            for (Subscription sub : subs) {
                 // TODO needs pojo wrapping from planet
-                list.add(sub); 
+                list.add(sub);
             }
         } catch (Exception e) {
             log.error("ERROR: get ranked blogs", e);

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/SiteModel.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/SiteModel.java?rev=1555104&r1=1555103&r2=1555104&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/SiteModel.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/SiteModel.java Fri Jan  3 14:16:28 2014
@@ -22,7 +22,6 @@ import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import org.apache.commons.lang.StringUtils;
@@ -388,17 +387,16 @@ public class SiteModel implements Model 
      * @param offset   Offset into results (for paging)
      * @param len      Max number of results to return
      */
-    public List getNewWeblogs(int sinceDays, int length) {
-        List results = new ArrayList();
+    public List<WeblogWrapper> getNewWeblogs(int sinceDays, int length) {
+        List<WeblogWrapper> results = new ArrayList<WeblogWrapper>();
         Calendar cal = Calendar.getInstance();
         cal.setTime(new Date());
         cal.add(Calendar.DATE, -1 * sinceDays);
         Date startDate = cal.getTime();
         try {            
-            List weblogs = WebloggerFactory.getWeblogger().getWeblogManager().getWeblogs(
+            List<Weblog> weblogs = WebloggerFactory.getWeblogger().getWeblogManager().getWeblogs(
                 Boolean.TRUE, Boolean.TRUE, startDate, null, 0, length);
-            for (Iterator it = weblogs.iterator(); it.hasNext();) {
-                Weblog website = (Weblog) it.next();
+            for (Weblog website : weblogs) {
                 results.add(WeblogWrapper.wrap(website, urlStrategy));
             }
         } catch (Exception e) {
@@ -413,14 +411,13 @@ public class SiteModel implements Model 
      * @param offset   Offset into results (for paging)
      * @param len      Max number of results to return
      */
-    public List getNewUsers(int sinceDays, int length) {
-        List results = new ArrayList();
+    public List<UserWrapper> getNewUsers(int sinceDays, int length) {
+        List<UserWrapper> results = new ArrayList<UserWrapper>();
         try {            
             Weblogger roller = WebloggerFactory.getWeblogger();
             UserManager umgr = roller.getUserManager();
-            List users = umgr.getUsers(Boolean.TRUE, null, null, 0, length);
-            for (Iterator it = users.iterator(); it.hasNext();) {
-                User user = (User) it.next();
+            List<User> users = umgr.getUsers(Boolean.TRUE, null, null, 0, length);
+            for (User user : users) {
                 results.add(UserWrapper.wrap(user));
             }
         } catch (Exception e) {
@@ -433,18 +430,16 @@ public class SiteModel implements Model 
     /**
      * Get list of WebsiteDisplay objects, ordered by number of hits.
      * @param sinceDays Only consider weblogs updated in the last sinceDays
-     * @param len      Max number of results to return
+     * @param length      Max number of results to return
      */
-    public List getHotWeblogs(int sinceDays, int length) {
+    public List<StatCount> getHotWeblogs(int sinceDays, int length) {
         
-        List results = new ArrayList();
+        List<StatCount> results = new ArrayList<StatCount>();
         try {
             WeblogEntryManager mgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
-            List hotBlogs = mgr.getHotWeblogs(sinceDays, 0, length);
+            List<WeblogHitCount> hotBlogs = mgr.getHotWeblogs(sinceDays, 0, length);
             
-            Iterator hitCounts = hotBlogs.iterator();
-            while (hitCounts.hasNext()) {
-                WeblogHitCount hitCount = (WeblogHitCount) hitCounts.next();
+            for (WeblogHitCount hitCount : hotBlogs) {
                 StatCount statCount = new StatCount(
                     hitCount.getWeblog().getId(),
                     hitCount.getWeblog().getHandle(),
@@ -467,7 +462,6 @@ public class SiteModel implements Model 
      * Get most collection of most commented websites, as StatCount objects,
      * in descending order by number of comments.
      * @param sinceDays Only consider weblogs updated in the last sinceDays
-     * @param offset   Offset into results (for paging)
      * @param length   Max number of results to return
      */
     public List getMostCommentedWeblogs(int sinceDays , int length) {
@@ -492,7 +486,7 @@ public class SiteModel implements Model 
      * objects, in descending order by number of comments.
      * @param sinceDays Only consider weblogs updated in the last sinceDays
      * @param cats     To limit results to list of category names
-     * @param len      Max number of results to return
+     * @param length      Max number of results to return
      */
     public List getMostCommentedWeblogEntries(
             List cats, int sinceDays, int length) {
@@ -514,17 +508,15 @@ public class SiteModel implements Model 
     
     /**
      * Get pinned entries.
-     * @param sinceDays Only consider weblogs updated in the last sinceDays
      * @param length    Max number of results to return
      */
-    public List getPinnedWeblogEntries(int length) {
-        List results = new ArrayList();
+    public List<WeblogEntryWrapper> getPinnedWeblogEntries(int length) {
+        List<WeblogEntryWrapper> results = new ArrayList<WeblogEntryWrapper>();
         try {            
             Weblogger roller = WebloggerFactory.getWeblogger();
             WeblogEntryManager wmgr = roller.getWeblogEntryManager();
-            List weblogs = wmgr.getWeblogEntriesPinnedToMain(length);
-            for (Iterator it = weblogs.iterator(); it.hasNext();) {
-                WeblogEntry entry = (WeblogEntry) it.next();
+            List<WeblogEntry> weblogEntries = wmgr.getWeblogEntriesPinnedToMain(length);
+            for (WeblogEntry entry : weblogEntries) {
                 results.add(WeblogEntryWrapper.wrap(entry, urlStrategy));
             }
         } catch (Exception e) {

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/Blacklist.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/Blacklist.java?rev=1555104&r1=1555103&r2=1555104&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/Blacklist.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/Blacklist.java Fri Jan  3 14:16:28 2014
@@ -33,7 +33,6 @@ import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.StringTokenizer;
@@ -73,8 +72,8 @@ public class Blacklist {
     private static final String BLACKLIST_URL = null;
 
     private Date lastModified = null;
-    private List blacklistStr = new LinkedList();
-    private List blacklistRegex = new LinkedList();
+    private List<String> blacklistStr = new LinkedList<String>();
+    private List<Pattern> blacklistRegex = new LinkedList<Pattern>();
     
     // setup our singleton at class loading time
     static {
@@ -162,7 +161,7 @@ public class Blacklist {
                 
                 // read from url and write to file
                 byte[] buf = new byte[4096];
-                int length = 0;
+                int length;
                 while((length = instream.read(buf)) > 0) {
                     outstream.write(buf, 0, length);
                 }
@@ -193,7 +192,7 @@ public class Blacklist {
      */
     public void loadBlacklistFromFile(String blacklistFilePath) {
         
-        InputStream txtStream = null;
+        InputStream txtStream;
         try {
             String path = blacklistFilePath;
             if (path == null) {
@@ -319,7 +318,7 @@ public class Blacklist {
      * @param moreRegexRules  Additional regex rules to consider 
      */
     public boolean isBlacklisted(
-         String str, List moreStringRules, List moreRegexRules) {
+         String str, List<String> moreStringRules, List<Pattern> moreRegexRules) {
         if (str == null || StringUtils.isEmpty(str)) {
             return false;
         }
@@ -329,9 +328,9 @@ public class Blacklist {
         // As soon as there is a hit in either case return true
         
         // test plain String.indexOf
-        List stringRules = blacklistStr;
+        List<String> stringRules = blacklistStr;
         if (moreStringRules != null && moreStringRules.size() > 0) {
-            stringRules = new ArrayList();
+            stringRules = new ArrayList<String>();
             stringRules.addAll(moreStringRules);
             stringRules.addAll(blacklistStr);
         }
@@ -340,9 +339,9 @@ public class Blacklist {
         }
         
         // test regex blacklisted
-        List regexRules = blacklistRegex;
+        List<Pattern> regexRules = blacklistRegex;
         if (moreRegexRules != null && moreRegexRules.size() > 0) {
-            regexRules = new ArrayList();
+            regexRules = new ArrayList<Pattern>();
             regexRules.addAll(moreRegexRules);
             regexRules.addAll(blacklistRegex);
         }
@@ -356,7 +355,7 @@ public class Blacklist {
      * @param regexRules  Regex rules to consider
      */
     public static boolean matchesRulesOnly(
-        String str, List stringRules, List regexRules) {
+        String str, List<String> stringRules, List<Pattern> regexRules) {
         if (testStringRules(str, stringRules)) {
             return true;
         }
@@ -364,19 +363,15 @@ public class Blacklist {
     }
         
     /** Test String against the RegularExpression rules. */
-    private static boolean testRegExRules(String str, List regexRules) {
+    private static boolean testRegExRules(String str, List<Pattern> regexRules) {
         boolean hit = false;
-        Pattern testPattern = null;
-        Iterator iter = regexRules.iterator();
-        while (iter.hasNext()) {
-            testPattern = (Pattern)iter.next();
-            
+        for (Pattern testPattern : regexRules) {
             // want to see what it is matching on, but only in debug mode
             if (mLogger.isDebugEnabled()) {
                 Matcher matcher = testPattern.matcher(str);
                 if (matcher.find()) {
-                    mLogger.debug(matcher.group() 
-                         + " matched by " + testPattern.pattern());
+                    mLogger.debug(matcher.group()
+                            + " matched by " + testPattern.pattern());
                     return true;
                 }
             } else {
@@ -444,7 +439,7 @@ public class Blacklist {
     
     /** Utility method to populate lists based a blacklist in string form */
     public static void populateSpamRules(
-        String blacklist, List stringRules, List regexRules, String addendum) {
+        String blacklist, List<String> stringRules, List<Pattern> regexRules, String addendum) {
         String weblogWords = blacklist;
         weblogWords = (weblogWords == null) ? "" : weblogWords;
         String siteWords = (addendum != null) ? addendum : "";

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/MailUtil.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/MailUtil.java?rev=1555104&r1=1555103&r2=1555104&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/MailUtil.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/MailUtil.java Fri Jan  3 14:16:28 2014
@@ -97,19 +97,18 @@ public class MailUtil {
             String content;
             
             // list of enabled website authors and admins
-            ArrayList reviewers = new ArrayList();
-            List websiteUsers = wmgr.getWeblogUsers(entry.getWebsite(), true);
+            List<String> reviewers = new ArrayList<String>();
+            List<User> websiteUsers = wmgr.getWeblogUsers(entry.getWebsite(), true);
             
             // build list of reviewers (website users with author permission)
-            Iterator websiteUserIter = websiteUsers.iterator();
-            while (websiteUserIter.hasNext()) {
-                User websiteUser = (User)websiteUserIter.next();
-                if (entry.getWebsite().hasUserPermission(                        
+            for (User websiteUser : websiteUsers) {
+                if (entry.getWebsite().hasUserPermission(
                         websiteUser, WeblogPermission.POST)
                         && websiteUser.getEmailAddress() != null) {
                     reviewers.add(websiteUser.getEmailAddress());
                 }
             }
+
             to = (String[])reviewers.toArray(new String[reviewers.size()]);
             
             // Figure URL to entry edit page
@@ -287,16 +286,15 @@ public class MailUtil {
         }
         
         // build list of email addresses to send notification to
-        Set subscribers = new TreeSet();
+        Set<String> subscribers = new TreeSet<String>();
         
         // If we are to notify subscribers, then...
         if (notifySubscribers) {
             log.debug("Sending notification email to all subscribers");
 
             // Get all the subscribers to this comment thread
-            List comments = entry.getComments(true, true);
-            for (Iterator it = comments.iterator(); it.hasNext();) {
-                WeblogEntryComment comment = (WeblogEntryComment) it.next();
+            List<WeblogEntryComment> comments = entry.getComments(true, true);
+            for (WeblogEntryComment comment : comments) {
                 if (!StringUtils.isEmpty(comment.getEmail()) && commentObject.getApproved()) {
                     // If user has commented twice, count the most recent notify setting
                     if (comment.getNotify()) {
@@ -410,7 +408,7 @@ public class MailUtil {
         ownermsg.append("Link to comment management page:");
         ownermsg.append((escapeHtml) ? "\n" : "<br />");
         
-        Map<String, String> parameters = new HashMap();
+        Map<String, String> parameters = new HashMap<String, String>();
         parameters.put("bean.entryId", entry.getId());
         String deleteURL = WebloggerFactory.getWeblogger().getUrlStrategy().getActionURL(
                 "comments", "/roller-ui/authoring", weblog.getHandle(), parameters, true);

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/RollerMessages.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/RollerMessages.java?rev=1555104&r1=1555103&r2=1555104&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/RollerMessages.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/RollerMessages.java Fri Jan  3 14:16:28 2014
@@ -27,8 +27,8 @@ import java.util.List;
  */
 public class RollerMessages
 {
-    private List mErrors = new ArrayList();
-    private List mMessages = new ArrayList();
+    private List<RollerMessage> mErrors = new ArrayList<RollerMessage>();
+    private List<RollerMessage> mMessages = new ArrayList<RollerMessage>();
     
     public RollerMessages() 
     {
@@ -76,17 +76,11 @@ public class RollerMessages
     public String toString() 
     {
         StringBuilder sb = new StringBuilder();
-        Iterator msgs = mMessages.iterator();
-        while (msgs.hasNext())
-        {
-            RollerMessage msg = (RollerMessage) msgs.next();
+        for (RollerMessage msg : mMessages) {
             sb.append(msg.getKey());
             sb.append(" : ");
         }
-        Iterator errs = mErrors.iterator();
-        while (errs.hasNext())
-        {
-            RollerMessage msg = (RollerMessage) errs.next();
+        for (RollerMessage msg : mErrors) {
             sb.append(msg.getKey());
             sb.append(" : ");
         }

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/URLUtilities.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/URLUtilities.java?rev=1555104&r1=1555103&r2=1555104&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/URLUtilities.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/URLUtilities.java Fri Jan  3 14:16:28 2014
@@ -38,29 +38,27 @@ public final class URLUtilities {
     /**
      * Compose a map of key=value params into a query string.
      */
-    public static String getQueryString(Map params) {
+    public static String getQueryString(Map<String, String> params) {
         
         if(params == null) {
             return null;
         }
         
         StringBuilder queryString = new StringBuilder();
-        
-        for(Iterator keys = params.keySet().iterator(); keys.hasNext();) {
-            String key = (String) keys.next();
-            String value = (String) params.get(key);
-            
+        for (String key : params.keySet()) {
+            String value = params.get(key);
+
             if (queryString.length() == 0) {
                 queryString.append("?");
             } else {
                 queryString.append("&");
             }
-            
+
             queryString.append(key);
             queryString.append("=");
             queryString.append(value);
         }
-        
+
         return queryString.toString();
     }
     

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/cache/CacheManager.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/cache/CacheManager.java?rev=1555104&r1=1555103&r2=1555104&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/cache/CacheManager.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/cache/CacheManager.java Fri Jan  3 14:16:28 2014
@@ -20,7 +20,6 @@ package org.apache.roller.weblogger.util
 
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 import org.apache.commons.logging.Log;
@@ -61,10 +60,10 @@ public final class CacheManager {
     private static CacheFactory cacheFactory = null;
     
     // a set of all registered cache handlers
-    private static Set cacheHandlers = new HashSet();
+    private static Set<CacheHandler> cacheHandlers = new HashSet<CacheHandler>();
     
     // a map of all registered caches
-    private static Map caches = new HashMap();
+    private static Map<String, Cache> caches = new HashMap<String, Cache>();
     
     
     static {
@@ -201,9 +200,9 @@ public final class CacheManager {
      * invalidated.
      */
     public static void registerHandler(CacheHandler handler) {
-        
+
         log.debug("Registering handler "+handler);
-        
+
         if(handler != null) {
             cacheHandlers.add(handler);
         }
@@ -213,10 +212,8 @@ public final class CacheManager {
     public static void invalidate(WeblogEntry entry) {
         
         log.debug("invalidating entry = "+entry.getAnchor());
-        
-        Iterator handlers = cacheHandlers.iterator();
-        while(handlers.hasNext()) {
-            ((CacheHandler) handlers.next()).invalidate(entry);
+        for (CacheHandler handler : cacheHandlers) {
+            handler.invalidate(entry);
         }
     }
     
@@ -224,10 +221,8 @@ public final class CacheManager {
     public static void invalidate(Weblog website) {
         
         log.debug("invalidating website = "+website.getHandle());
-        
-        Iterator handlers = cacheHandlers.iterator();
-        while(handlers.hasNext()) {
-            ((CacheHandler) handlers.next()).invalidate(website);
+        for (CacheHandler handler : cacheHandlers) {
+            handler.invalidate(website);
         }
     }
     
@@ -235,10 +230,8 @@ public final class CacheManager {
     public static void invalidate(WeblogBookmark bookmark) {
         
         log.debug("invalidating bookmark = "+bookmark.getId());
-        
-        Iterator handlers = cacheHandlers.iterator();
-        while(handlers.hasNext()) {
-            ((CacheHandler) handlers.next()).invalidate(bookmark);
+        for (CacheHandler handler : cacheHandlers) {
+            handler.invalidate(bookmark);
         }
     }
     
@@ -246,10 +239,8 @@ public final class CacheManager {
     public static void invalidate(WeblogBookmarkFolder folder) {
         
         log.debug("invalidating folder = "+folder.getId());
-        
-        Iterator handlers = cacheHandlers.iterator();
-        while(handlers.hasNext()) {
-            ((CacheHandler) handlers.next()).invalidate(folder);
+        for (CacheHandler handler : cacheHandlers) {
+            handler.invalidate(folder);
         }
     }
     
@@ -257,10 +248,8 @@ public final class CacheManager {
     public static void invalidate(WeblogEntryComment comment) {
         
         log.debug("invalidating comment = "+comment.getId());
-        
-        Iterator handlers = cacheHandlers.iterator();
-        while(handlers.hasNext()) {
-            ((CacheHandler) handlers.next()).invalidate(comment);
+        for (CacheHandler handler : cacheHandlers) {
+            handler.invalidate(comment);
         }
     }
     
@@ -272,10 +261,8 @@ public final class CacheManager {
         // NOTE: Invalidating an entire website for each referer is not
         //       good for our caching.  This may need reevaluation later.
         //lastExpiredCache.put(referer.getWebsite().getHandle(), new Date());
-        
-        Iterator handlers = cacheHandlers.iterator();
-        while(handlers.hasNext()) {
-            ((CacheHandler) handlers.next()).invalidate(referer);
+        for (CacheHandler handler : cacheHandlers) {
+            handler.invalidate(referer);
         }
     }
     
@@ -283,32 +270,25 @@ public final class CacheManager {
     public static void invalidate(User user) {
         
         log.debug("invalidating user = "+user.getUserName());
-        
-        Iterator handlers = cacheHandlers.iterator();
-        while(handlers.hasNext()) {
-            ((CacheHandler) handlers.next()).invalidate(user);
+        for (CacheHandler handler : cacheHandlers) {
+            handler.invalidate(user);
         }
     }
     
     
     public static void invalidate(WeblogCategory category) {
         
-        log.debug("invalidating category = "+category.getId());
-        
-        Iterator handlers = cacheHandlers.iterator();
-        while(handlers.hasNext()) {
-            ((CacheHandler) handlers.next()).invalidate(category);
+        log.debug("invalidating category = " + category.getId());
+        for (CacheHandler handler : cacheHandlers) {
+            handler.invalidate(category);
         }
     }
     
     
     public static void invalidate(WeblogTemplate template) {
-        
-        log.debug("invalidating template = "+template.getId());
-        
-        Iterator handlers = cacheHandlers.iterator();
-        while(handlers.hasNext()) {
-            ((CacheHandler) handlers.next()).invalidate(template);
+        log.debug("invalidating template = " + template.getId());
+        for (CacheHandler handler : cacheHandlers) {
+            handler.invalidate(template);
         }
     }
 
@@ -317,13 +297,7 @@ public final class CacheManager {
      * Flush the entire cache system.
      */
     public static void clear() {
-        
-        // loop through all caches and trigger a clear
-        Cache cache = null;
-        Iterator cachesIT = caches.values().iterator();
-        while(cachesIT.hasNext()) {
-            cache = (Cache) cachesIT.next();
-            
+        for (Cache cache : caches.values()) {
             cache.clear();
         }
     }
@@ -333,8 +307,7 @@ public final class CacheManager {
      * Flush a single cache.
      */
     public static void clear(String cacheId) {
-        
-        Cache cache = (Cache) caches.get(cacheId);
+        Cache cache = caches.get(cacheId);
         if(cache != null) {
             cache.clear();
         }
@@ -350,17 +323,10 @@ public final class CacheManager {
      * something a bit more elaborate, like JMX.
      */
     public static Map getStats() {
-        
         Map allStats = new HashMap();
-        
-        Cache cache = null;
-        Iterator cachesIT = caches.values().iterator();
-        while(cachesIT.hasNext()) {
-            cache = (Cache) cachesIT.next();
-            
+        for (Cache cache : caches.values()) {
             allStats.put(cache.getId(), cache.getStats());
         }
-        
         return allStats;
     }
     

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/webservices/adminprotocol/sdk/MemberEntrySet.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/webservices/adminprotocol/sdk/MemberEntrySet.java?rev=1555104&r1=1555103&r2=1555104&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/webservices/adminprotocol/sdk/MemberEntrySet.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/webservices/adminprotocol/sdk/MemberEntrySet.java Fri Jan  3 14:16:28 2014
@@ -26,7 +26,6 @@ package org.apache.roller.weblogger.webs
 import java.io.InputStream;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 import org.jdom.Document;
 import org.jdom.Element;
@@ -65,15 +64,14 @@ public class MemberEntrySet extends Entr
         if (!rootName.equals(Tags.MEMBERS)) {
             throw new UnexpectedRootElementException("ERROR: Incorrect root element", Tags.MEMBERS, rootName);
         }
-        List members = root.getChildren(MemberEntry.Tags.MEMBER, NAMESPACE);
+        List<Element> members = root.getChildren(MemberEntry.Tags.MEMBER, NAMESPACE);
         if (members != null) {
-            List entries = new ArrayList();
-            for (Iterator i = members.iterator(); i.hasNext(); ) {
-                Element member = (Element)i.next();
+            List<MemberEntry> entries = new ArrayList<MemberEntry>();
+            for (Element member : members) {
                 MemberEntry entry = new MemberEntry(member, urlPrefix);
                 entries.add(entry);
             }
-            setEntries((Entry[])entries.toArray(new Entry[0]));
+            setEntries(entries.toArray(new Entry[0]));
         }
         setHref(urlPrefix + "/" + Types.MEMBERS);
     }

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/webservices/adminprotocol/sdk/Service.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/webservices/adminprotocol/sdk/Service.java?rev=1555104&r1=1555103&r2=1555104&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/webservices/adminprotocol/sdk/Service.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/webservices/adminprotocol/sdk/Service.java Fri Jan  3 14:16:28 2014
@@ -25,9 +25,7 @@ package org.apache.roller.weblogger.webs
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
-import org.apache.roller.weblogger.webservices.adminprotocol.sdk.EntrySet.Types;
 
 import org.jdom.Document;
 import org.jdom.Element;
@@ -77,16 +75,14 @@ public class Service extends EntrySet {
 
     public void populate(Document doc) {
         Element root = doc.getRootElement();
-        List workspaces = new ArrayList();
-        List spaces = root.getChildren("workspace", NAMESPACE);
-        Iterator iter = spaces.iterator();
-        while (iter.hasNext()) {
-            Element e = (Element) iter.next();
+        List<Workspace> workspaces = new ArrayList<Workspace>();
+        List<Element> spaces = root.getChildren("workspace", NAMESPACE);
+        for (Element e : spaces) {
             Workspace ws = new Workspace();
             ws.populate(e);
             workspaces.add(ws);
         }
-        setEntries((Entry[])workspaces.toArray(new Workspace[0]));
+        setEntries(workspaces.toArray(new Workspace[0]));
     }
             
     /** This class describes a service workspace. */    
@@ -130,16 +126,14 @@ public class Service extends EntrySet {
         
         public void populate(Element elem) {
             setTitle(elem.getAttributeValue(Attributes.TITLE)); //, NAMESPACE));
-            List collections = new ArrayList();
-            List spaces = elem.getChildren("collection", NAMESPACE);
-            Iterator iter = spaces.iterator();
-            while (iter.hasNext()) {
-                Element e = (Element) iter.next();
+            List<Collection> collections = new ArrayList<Collection>();
+            List<Element> spaces = elem.getChildren("collection", NAMESPACE);
+            for (Element e : spaces) {
                 Collection col = new Collection();
                 col.populate(e);
                 collections.add(col);
             }
-            Workspace.this.setEntries((Entry[])collections.toArray(new Collection[0]));
+            Workspace.this.setEntries(collections.toArray(new Collection[0]));
         }
 
 



Mime
View raw message