roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r1588757 [10/25] - in /roller/branches/rome2/app/src: main/java/org/apache/roller/ main/java/org/apache/roller/planet/business/ main/java/org/apache/roller/planet/business/fetcher/ main/java/org/apache/roller/planet/business/jpa/ main/java/...
Date Sun, 20 Apr 2014 13:39:01 GMT
Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/CommentsPager.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/CommentsPager.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/CommentsPager.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/CommentsPager.java Sun Apr 20 13:38:51 2014
@@ -22,7 +22,6 @@ import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -30,6 +29,7 @@ import org.apache.roller.weblogger.busin
 import org.apache.roller.weblogger.business.Weblogger;
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.business.WeblogEntryManager;
+import org.apache.roller.weblogger.pojos.CommentSearchCriteria;
 import org.apache.roller.weblogger.pojos.WeblogEntryComment;
 import org.apache.roller.weblogger.pojos.Weblog;
 import org.apache.roller.weblogger.pojos.wrapper.WeblogEntryCommentWrapper;
@@ -43,12 +43,11 @@ public class CommentsPager extends Abstr
     private static Log log = LogFactory.getLog(CommentsPager.class);
     
     private Weblog weblog = null;
-    private String locale = null;
     private int sinceDays = -1;
     private int length = 0;
     
     // the collection for the pager
-    private List comments = null;
+    private List<WeblogEntryCommentWrapper> comments = null;
     
     // are there more items?
     private boolean more = false;
@@ -60,7 +59,6 @@ public class CommentsPager extends Abstr
             URLStrategy    strat,
             String         baseUrl,
             Weblog         weblog,
-            String         locale,
             int            sinceDays,
             int            page,
             int            length) {
@@ -68,7 +66,6 @@ public class CommentsPager extends Abstr
         super(strat, baseUrl, page);
         
         this.weblog = weblog;
-        this.locale = locale;
         this.sinceDays = sinceDays;
         this.length = length;
         
@@ -77,13 +74,13 @@ public class CommentsPager extends Abstr
     }
     
     
-    public List getItems() {
+    public List<WeblogEntryCommentWrapper> getItems() {
         
         if (comments == null) {
             // calculate offset
             int offset = getPage() * length;
             
-            List results = new ArrayList();
+            List<WeblogEntryCommentWrapper> results = new ArrayList<WeblogEntryCommentWrapper>();
             
             Date startDate = null;
             if(sinceDays > 0) {
@@ -96,13 +93,20 @@ public class CommentsPager extends Abstr
             try {
                 Weblogger roller = WebloggerFactory.getWeblogger();
                 WeblogEntryManager wmgr = roller.getWeblogEntryManager();
-                List entries = wmgr.getComments(
-                        weblog, null, null, startDate, null, WeblogEntryComment.APPROVED, true, offset, length + 1);
+
+                CommentSearchCriteria csc = new CommentSearchCriteria();
+                csc.setWeblog(weblog);
+                csc.setStartDate(startDate);
+                csc.setStatus(WeblogEntryComment.APPROVED);
+                csc.setReverseChrono(true);
+                csc.setOffset(offset);
+                csc.setMaxResults(length + 1);
+
+                List<WeblogEntryComment> commentsList = wmgr.getComments(csc);
                 
                 // wrap the results
                 int count = 0;
-                for (Iterator it = entries.iterator(); it.hasNext();) {
-                    WeblogEntryComment comment = (WeblogEntryComment) it.next();
+                for (WeblogEntryComment comment : commentsList) {
                     if (count++ < length) {
                         results.add(WeblogEntryCommentWrapper.wrap(comment, urlStrategy));
                     } else {
@@ -129,9 +133,9 @@ public class CommentsPager extends Abstr
     public Date getLastUpdated() {
         if (lastUpdated == null) {
             // feeds are sorted by pubtime, so first might not be last updated
-            List<WeblogEntryCommentWrapper> items = (List<WeblogEntryCommentWrapper>)getItems();
+            List<WeblogEntryCommentWrapper> items = getItems();
             if (getItems() != null && getItems().size() > 0) {
-                Timestamp newest = ((WeblogEntryCommentWrapper)getItems().get(0)).getPostTime();
+                Timestamp newest = (getItems().get(0)).getPostTime();
                 for (WeblogEntryCommentWrapper c : items) {
                     if (c.getPostTime().after(newest)) {
                         newest = c.getPostTime();

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/MediaFilesPager.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/MediaFilesPager.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/MediaFilesPager.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/MediaFilesPager.java Sun Apr 20 13:38:51 2014
@@ -29,7 +29,6 @@ import org.apache.roller.weblogger.busin
 import org.apache.roller.weblogger.business.URLStrategy;
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.pojos.MediaFile;
-import org.apache.roller.weblogger.pojos.Weblog;
 
 
 /**
@@ -38,32 +37,21 @@ import org.apache.roller.weblogger.pojos
 public class MediaFilesPager extends AbstractPager {
     
     private static Log log = LogFactory.getLog(MediaFilesPager.class);
-    
-    private Weblog weblog = null;
-    private int sinceDays = -1;
     private int length = 0;
     
     // the collection for the pager
     private List<MediaFile> mediaFiles;
     
-    // are there more items?
-    private boolean more = false;
-    
     // most recent update time of current set of entries
     private Date lastUpdated = null;        
     
     public MediaFilesPager(
             URLStrategy    strat,
             String         baseUrl,
-            Weblog         weblog,
-            int            sinceDays,
             int            page,
             int            length) {
         
         super(strat, baseUrl, page);
-        
-        this.weblog = weblog;
-        this.sinceDays = sinceDays;
         this.length = length;
         
         // initialize the collection
@@ -93,16 +81,16 @@ public class MediaFilesPager extends Abs
     
     
     public boolean hasMoreItems() {
-        return more;
+        return false;
     }
     
     /** Get last updated time from items in pager */
     public Date getLastUpdated() {
         if (lastUpdated == null) {
             // feeds are sorted by pubtime, so first might not be last updated
-            List<MediaFile> items = (List<MediaFile>)getItems();
+            List<MediaFile> items = getItems();
             if (items != null && items.size() > 0) {
-                Timestamp newest = ((MediaFile)items.get(0)).getLastUpdated();
+                Timestamp newest = items.get(0).getLastUpdated();
                 for (MediaFile file : items) {
                     if (file.getLastUpdated().after(newest)) {
                         newest = file.getLastUpdated();

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/PlanetEntriesPager.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/PlanetEntriesPager.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/PlanetEntriesPager.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/PlanetEntriesPager.java Sun Apr 20 13:38:51 2014
@@ -21,7 +21,6 @@ package org.apache.roller.weblogger.ui.r
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -43,12 +42,11 @@ public class PlanetEntriesPager extends 
     
     private String feedURL = null;
     private String groupHandle = null;
-    private String locale = null;
     private int sinceDays = -1;
     private int length = 0;
     
     // the collection for the pager
-    private List entries = null;
+    private List<SubscriptionEntry> entries = null;
     
     // are there more items?
     private boolean more = false;
@@ -59,7 +57,6 @@ public class PlanetEntriesPager extends 
             String         feedURL,
             String         groupHandle,
             String         baseUrl,
-            String         locale,
             int            sinceDays,
             int            page,
             int            length) {
@@ -68,7 +65,6 @@ public class PlanetEntriesPager extends 
         
         this.feedURL = feedURL;
         this.groupHandle = groupHandle;
-        this.locale = locale;
         this.sinceDays = sinceDays;
         this.length = length;
         
@@ -77,7 +73,7 @@ public class PlanetEntriesPager extends 
     }
     
     
-    public List getItems() {
+    public List<SubscriptionEntry> getItems() {
         
         if (entries == null) {
             // calculate offset
@@ -91,27 +87,26 @@ public class PlanetEntriesPager extends 
                 startDate = cal.getTime();
             }
             
-            List results = new ArrayList();
+            List<SubscriptionEntry> results = new ArrayList<SubscriptionEntry>();
             try {
                 PlanetManager planetManager = WebloggerFactory.getWeblogger().getPlanetManager();
                 Planet planet = planetManager.getWeblogger("default");
                 
-                List entries = null;
+                List<SubscriptionEntry> subEntries;
                 if (feedURL != null) {
                     Subscription sub = planetManager.getSubscription(feedURL);
-                    entries = planetManager.getEntries(sub, offset, length+1);
+                    subEntries = planetManager.getEntries(sub, offset, length+1);
                 } else if (groupHandle != null) {
                     PlanetGroup group = planetManager.getGroup(planet, groupHandle);
-                    entries = planetManager.getEntries(group, startDate, null, offset, length+1);
+                    subEntries = planetManager.getEntries(group, startDate, null, offset, length + 1);
                 } else {
                     PlanetGroup group = planetManager.getGroup(planet, "all");
-                    entries = planetManager.getEntries(group, startDate, null, offset, length+1);
+                    subEntries = planetManager.getEntries(group, startDate, null, offset, length + 1);
                 }
                 
                 // wrap 'em
                 int count = 0;
-                for (Iterator it = entries.iterator(); it.hasNext();) {
-                    SubscriptionEntry entry = (SubscriptionEntry) it.next();
+                for (SubscriptionEntry entry : subEntries) {
                     // TODO needs pojo wrapping from planet
                     if (count++ < length) { 
                         results.add(entry);

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/UsersPager.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/UsersPager.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/UsersPager.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/UsersPager.java Sun Apr 20 13:38:51 2014
@@ -20,7 +20,6 @@ package org.apache.roller.weblogger.ui.r
 
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import org.apache.commons.logging.Log;
@@ -41,12 +40,10 @@ public class UsersPager extends Abstract
     private static Log log = LogFactory.getLog(UsersPager.class);
     
     private String letter = null;
-    private String locale = null;
-    private int sinceDays = -1;
     private int length = 0;
     
     // collection for the pager
-    private List users;
+    private List<UserWrapper> users;
     
     // are there more items?
     private boolean more = false;
@@ -62,8 +59,6 @@ public class UsersPager extends Abstract
         
         super(strat, baseUrl, page);
         
-        this.locale = locale;
-        this.sinceDays = sinceDays;
         this.length = length;
         
         // initialize the collection
@@ -83,8 +78,6 @@ public class UsersPager extends Abstract
         super(strat, baseUrl, page);
         
         this.letter = letter;
-        this.locale = locale;
-        this.sinceDays = sinceDays;
         this.length = length;
         
         // initialize the collection
@@ -126,17 +119,17 @@ public class UsersPager extends Abstract
     }
     
     
-    public List getItems() {
+    public List<UserWrapper> getItems() {
         
         if (users == null) {
             // calculate offset
             int offset = getPage() * length;
             
-            List results = new ArrayList();
+            List<UserWrapper> results = new ArrayList<UserWrapper>();
             try {
                 Weblogger roller = WebloggerFactory.getWeblogger();
                 UserManager umgr = roller.getUserManager();
-                List rawUsers = null;
+                List<User> rawUsers;
                 if (letter == null) {
                     rawUsers = umgr.getUsers(Boolean.TRUE, null, null, offset, length + 1);
                 } else {
@@ -145,8 +138,7 @@ public class UsersPager extends Abstract
                 
                 // wrap the results
                 int count = 0;
-                for (Iterator it = rawUsers.iterator(); it.hasNext();) {
-                    User user = (User) it.next();
+                for (User user : rawUsers) {
                     if (count++ < length) {
                         results.add(UserWrapper.wrap(user));
                     } else {

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesDayPager.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesDayPager.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesDayPager.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesDayPager.java Sun Apr 20 13:38:51 2014
@@ -22,18 +22,16 @@ import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
 import org.apache.commons.collections.comparators.ReverseComparator;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.roller.weblogger.business.Weblogger;
 import org.apache.roller.weblogger.business.WebloggerFactory;
-import org.apache.roller.weblogger.business.WeblogEntryManager;
 import org.apache.roller.weblogger.pojos.WeblogEntry;
 import org.apache.roller.weblogger.pojos.Weblog;
+import org.apache.roller.weblogger.pojos.WeblogEntrySearchCriteria;
 import org.apache.roller.weblogger.pojos.wrapper.WeblogEntryWrapper;
 import org.apache.roller.util.DateUtil;
 import org.apache.roller.weblogger.business.URLStrategy;
@@ -53,7 +51,7 @@ public class WeblogEntriesDayPager exten
     private Date prevDay;
     
     // collection for the pager
-    private Map entries = null;
+    private Map<Date, List<WeblogEntryWrapper>> entries = null;
     
     // are there more pages?
     private boolean more = false;
@@ -66,11 +64,11 @@ public class WeblogEntriesDayPager exten
             String             pageLink,
             String             entryAnchor,
             String             dateString,
-            String             catPath,
+            String             catName,
             List               tags,
             int                page) {
         
-        super(strat, weblog, locale, pageLink, entryAnchor, dateString, catPath, tags, page);
+        super(strat, weblog, locale, pageLink, entryAnchor, dateString, catName, tags, page);
         
         dayFormat = new SimpleDateFormat(
             messageUtils.getString("weblogEntriesPager.day.dateFormat"));
@@ -104,51 +102,47 @@ public class WeblogEntriesDayPager exten
     }
     
     
-    public Map getEntries() {
+    public Map<Date, List<WeblogEntryWrapper>> getEntries() {
         Date date = parseDate(dateString);
         Calendar cal = Calendar.getInstance(weblog.getTimeZoneInstance());
-        Date startDate = null;
+        Date startDate;
         Date endDate = date;
         startDate = DateUtil.getStartOfDay(endDate, cal);
         endDate = DateUtil.getEndOfDay(endDate, cal);
         
         if (entries == null) {
-            entries = new TreeMap(new ReverseComparator());
+            entries = new TreeMap<Date, List<WeblogEntryWrapper>>(new ReverseComparator());
             try {
-                Weblogger roller = WebloggerFactory.getWeblogger();
-                WeblogEntryManager wmgr = roller.getWeblogEntryManager();
-                Map mmap = WebloggerFactory.getWeblogger().getWeblogEntryManager().getWeblogEntryObjectMap(
-                        
-                        weblog,
-                        startDate,
-                        endDate,
-                        catPath,
-                        tags,WeblogEntry.PUBLISHED, 
-                        locale,
-                        offset,  
-                        length + 1);
-                
+                WeblogEntrySearchCriteria wesc = new WeblogEntrySearchCriteria();
+                wesc.setWeblog(weblog);
+                wesc.setStartDate(startDate);
+                wesc.setEndDate(endDate);
+                wesc.setCatName(catName);
+                wesc.setTags(tags);
+                wesc.setStatus(WeblogEntry.PUBLISHED);
+                wesc.setLocale(locale);
+                wesc.setOffset(offset);
+                wesc.setMaxResults(length+1);
+                Map<Date, List<WeblogEntry>> mmap =
+                        WebloggerFactory.getWeblogger().getWeblogEntryManager().getWeblogEntryObjectMap(wesc);
+
                 // need to wrap pojos
                 int count = 0;
-                Date key = null;
-                Iterator days = mmap.keySet().iterator();
-                while(days.hasNext()) {
-                    key = (Date) days.next();
-                    
+                for (Map.Entry<Date, List<WeblogEntry>> entry : mmap.entrySet()) {
                     // now we need to go through each entry in a day and wrap
-                    List wrapped = new ArrayList();
-                    List unwrapped = (List) mmap.get(key);
-                    for(int i=0; i < unwrapped.size(); i++) {
+                    List<WeblogEntryWrapper> wrapped = new ArrayList<WeblogEntryWrapper>();
+                    List<WeblogEntry> unwrapped = entry.getValue();
+                    for (int i=0; i < unwrapped.size(); i++) {
                         if (count++ < length) {
-                            wrapped.add(i,WeblogEntryWrapper.wrap((WeblogEntry)unwrapped.get(i), urlStrategy));
+                            wrapped.add(i,WeblogEntryWrapper.wrap(unwrapped.get(i), urlStrategy));
                         } else {
                             more = true;
                         }
                     }
                     
                     // done with that day, put it in the map
-                    if(wrapped.size() > 0) {
-                        entries.put(key, wrapped);
+                    if (wrapped.size() > 0) {
+                        entries.put(entry.getKey(), wrapped);
                     }
                 }
                 
@@ -162,7 +156,7 @@ public class WeblogEntriesDayPager exten
     
     
     public String getHomeLink() {
-        return createURL(0, 0, weblog, locale, pageLink, null, null, catPath, tags);
+        return createURL(0, 0, weblog, locale, pageLink, null, null, catName, tags);
     }
     
     
@@ -173,7 +167,7 @@ public class WeblogEntriesDayPager exten
     
     public String getNextLink() {
         if (more) {
-            return createURL(page, 1, weblog, locale, pageLink, null, dateString, catPath, tags);
+            return createURL(page, 1, weblog, locale, pageLink, null, dateString, catName, tags);
         }
         return null;
     }
@@ -189,7 +183,7 @@ public class WeblogEntriesDayPager exten
     
     public String getPrevLink() {
         if (page > 0) {
-            return createURL(page, -1, weblog, locale, pageLink, null, dateString, catPath, tags);
+            return createURL(page, -1, weblog, locale, pageLink, null, dateString, catName, tags);
         }
         return null;
     }
@@ -206,7 +200,7 @@ public class WeblogEntriesDayPager exten
     public String getNextCollectionLink() {
         if (nextDay != null) {
             String next = DateUtil.format8chars(nextDay);
-            return createURL(0, 0, weblog, locale, pageLink, null, next, catPath, tags);
+            return createURL(0, 0, weblog, locale, pageLink, null, next, catName, tags);
         }
         return null;
     }
@@ -223,7 +217,7 @@ public class WeblogEntriesDayPager exten
     public String getPrevCollectionLink() {
         if (prevDay != null) {
             String prev = DateUtil.format8chars(prevDay);
-            return createURL(0, 0, weblog, locale, pageLink, null, prev, catPath, tags);
+            return createURL(0, 0, weblog, locale, pageLink, null, prev, catName, tags);
         }
         return null;
     }

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesLatestPager.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesLatestPager.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesLatestPager.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesLatestPager.java Sun Apr 20 13:38:51 2014
@@ -20,7 +20,6 @@ package org.apache.roller.weblogger.ui.r
 
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
@@ -28,11 +27,10 @@ import org.apache.commons.collections.co
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.business.URLStrategy;
-import org.apache.roller.weblogger.business.Weblogger;
 import org.apache.roller.weblogger.business.WebloggerFactory;
-import org.apache.roller.weblogger.business.WeblogEntryManager;
 import org.apache.roller.weblogger.pojos.WeblogEntry;
 import org.apache.roller.weblogger.pojos.Weblog;
+import org.apache.roller.weblogger.pojos.WeblogEntrySearchCriteria;
 import org.apache.roller.weblogger.pojos.wrapper.WeblogEntryWrapper;
 
 
@@ -44,7 +42,7 @@ public class WeblogEntriesLatestPager ex
     private static Log log = LogFactory.getLog(WeblogEntriesLatestPager.class);
     
     // collection for the pager
-    private Map entries = null;
+    private Map<Date, List<WeblogEntryWrapper>> entries = null;
     
     // are there more pages?
     private boolean more = false;
@@ -57,56 +55,50 @@ public class WeblogEntriesLatestPager ex
             String             pageLink,
             String             entryAnchor,
             String             dateString,
-            String             catPath,
+            String             catName,
             List               tags,
             int                page) {
         
-        super(strat, weblog, locale, pageLink, entryAnchor, dateString, catPath, tags, page);
+        super(strat, weblog, locale, pageLink, entryAnchor, dateString, catName, tags, page);
         
         // initialize the pager collection
         getEntries();
     }
     
     
-    public Map getEntries() {
+    public Map<Date, List<WeblogEntryWrapper>> getEntries() {
         
         if (entries == null) {
-            entries = new TreeMap(new ReverseComparator());
+            entries = new TreeMap<Date, List<WeblogEntryWrapper>>(new ReverseComparator());
             try {
-                Weblogger roller = WebloggerFactory.getWeblogger();
-                WeblogEntryManager wmgr = roller.getWeblogEntryManager();
-                Map mmap = WebloggerFactory.getWeblogger().getWeblogEntryManager().getWeblogEntryObjectMap(
-                        weblog,
-                        null,
-                        new Date(),
-                        catPath,
-                        tags,
-                        WeblogEntry.PUBLISHED,
-                        locale,
-                        offset,
-                        length + 1);
-                
+                WeblogEntrySearchCriteria wesc = new WeblogEntrySearchCriteria();
+                wesc.setWeblog(weblog);
+                wesc.setEndDate(new Date());
+                wesc.setCatName(catName);
+                wesc.setTags(tags);
+                wesc.setStatus(WeblogEntry.PUBLISHED);
+                wesc.setLocale(locale);
+                wesc.setOffset(offset);
+                wesc.setMaxResults(length+1);
+                Map<Date, List<WeblogEntry>> mmap = WebloggerFactory.getWeblogger().getWeblogEntryManager().getWeblogEntryObjectMap(wesc);
+
                 // need to wrap pojos
                 int count = 0;
-                java.util.Date key = null;
-                Iterator days = mmap.keySet().iterator();
-                while(days.hasNext()) {
-                    key = (java.util.Date)days.next();
-                    
+                for (Map.Entry<Date, List<WeblogEntry>> entry : mmap.entrySet()) {
                     // now we need to go through each entry in a day and wrap
-                    List wrapped = new ArrayList();
-                    List unwrapped= (List) mmap.get(key);
-                    for(int i=0; i < unwrapped.size(); i++) {
+                    List<WeblogEntryWrapper> wrapped = new ArrayList<WeblogEntryWrapper>();
+                    List<WeblogEntry> unwrapped = entry.getValue();
+                    for (int i=0; i < unwrapped.size(); i++) {
                         if (count++ < length) {
-                            wrapped.add(i,WeblogEntryWrapper.wrap((WeblogEntry)unwrapped.get(i), urlStrategy));
+                            wrapped.add(i,WeblogEntryWrapper.wrap(unwrapped.get(i), urlStrategy));
                         } else {
                             more = true;
                         }
                     }
                     
                     // done with that day, put it in the map
-                    if(wrapped.size() > 0) {
-                        entries.put(key, wrapped);
+                    if (wrapped.size() > 0) {
+                        entries.put(entry.getKey(), wrapped);
                     }
                 }
             } catch (Exception e) {

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesListPager.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesListPager.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesListPager.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesListPager.java Sun Apr 20 13:38:51 2014
@@ -22,17 +22,15 @@ import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.business.URLStrategy;
-import org.apache.roller.weblogger.business.Weblogger;
 import org.apache.roller.weblogger.business.WebloggerFactory;
-import org.apache.roller.weblogger.business.WeblogEntryManager;
 import org.apache.roller.weblogger.pojos.User;
 import org.apache.roller.weblogger.pojos.WeblogEntry;
 import org.apache.roller.weblogger.pojos.Weblog;
+import org.apache.roller.weblogger.pojos.WeblogEntrySearchCriteria;
 import org.apache.roller.weblogger.pojos.wrapper.WeblogEntryWrapper;
 
 
@@ -50,10 +48,10 @@ public class WeblogEntriesListPager exte
     private Weblog queryWeblog = null;
     private User queryUser = null;
     private String queryCat = null;
-    private List queryTags = null;
+    private List<String> queryTags = null;
     
     // entries for the pager
-    private List entries;
+    private List<WeblogEntryWrapper> entries;
     
     // are there more entries?
     private boolean more = false;
@@ -68,7 +66,7 @@ public class WeblogEntriesListPager exte
             Weblog         queryWeblog,
             User           queryUser,
             String         queryCat,
-            List           queryTags,
+            List<String>   queryTags,
             String         locale,
             int            sinceDays,
             int            pageNum,
@@ -90,13 +88,13 @@ public class WeblogEntriesListPager exte
     }
     
     
-    public List getItems() {
+    public List<WeblogEntryWrapper> getItems() {
         
         if (entries == null) {
             // calculate offset
             int offset = getPage() * length;
-            
-            List results = new ArrayList();
+
+            List<WeblogEntryWrapper> results = new ArrayList<WeblogEntryWrapper>();
             
             Date startDate = null;
             if(sinceDays > 0) {
@@ -107,26 +105,22 @@ public class WeblogEntriesListPager exte
             }
             
             try {
-                Weblogger roller = WebloggerFactory.getWeblogger();
-                WeblogEntryManager wmgr = roller.getWeblogEntryManager();
-                List rawEntries = wmgr.getWeblogEntries(
-                        queryWeblog,
-                        queryUser,
-                        startDate,
-                        null,
-                        queryCat,
-                        queryTags,WeblogEntry.PUBLISHED,
-                        null,
-                        "pubTime",
-                        null,
-                        locale,
-                        offset,
-                        length + 1);
-                                
+                WeblogEntrySearchCriteria wesc = new WeblogEntrySearchCriteria();
+                wesc.setWeblog(queryWeblog);
+                wesc.setUser(queryUser);
+                wesc.setStartDate(startDate);
+                wesc.setCatName(queryCat);
+                wesc.setTags(queryTags);
+                wesc.setStatus(WeblogEntry.PUBLISHED);
+                wesc.setLocale(locale);
+                wesc.setOffset(offset);
+                wesc.setMaxResults(length+1);
+                List<WeblogEntry> rawEntries = WebloggerFactory.getWeblogger()
+                        .getWeblogEntryManager().getWeblogEntries(wesc);
+
                 // wrap the results
                 int count = 0;
-                for (Iterator it = rawEntries.iterator(); it.hasNext();) {
-                    WeblogEntry entry = (WeblogEntry) it.next();
+                for (WeblogEntry entry : rawEntries) {
                     if (count++ < length) {
                         results.add(WeblogEntryWrapper.wrap(entry, urlStrategy));
                     }
@@ -154,9 +148,9 @@ public class WeblogEntriesListPager exte
     public Date getLastUpdated() {
         if (lastUpdated == null) {
             // feeds are sorted by pubtime, so first might not be last updated
-            List<WeblogEntryWrapper> items = (List<WeblogEntryWrapper>)getItems();
+            List<WeblogEntryWrapper> items = getItems();
             if (getItems() != null && getItems().size() > 0) {
-                Timestamp newest = ((WeblogEntryWrapper)getItems().get(0)).getUpdateTime();
+                Timestamp newest = (getItems().get(0)).getUpdateTime();
                 for (WeblogEntryWrapper e : items) {
                     if (e.getUpdateTime().after(newest)) {
                         newest = e.getPubTime();

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesMonthPager.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesMonthPager.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesMonthPager.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesMonthPager.java Sun Apr 20 13:38:51 2014
@@ -22,7 +22,6 @@ import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
@@ -32,6 +31,7 @@ import org.apache.commons.logging.LogFac
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.pojos.WeblogEntry;
 import org.apache.roller.weblogger.pojos.Weblog;
+import org.apache.roller.weblogger.pojos.WeblogEntrySearchCriteria;
 import org.apache.roller.weblogger.pojos.wrapper.WeblogEntryWrapper;
 import org.apache.roller.util.DateUtil;
 import org.apache.roller.weblogger.business.URLStrategy;
@@ -51,7 +51,7 @@ public class WeblogEntriesMonthPager ext
     private Date prevMonth;
     
     // collection for the pager
-    private Map entries = null;
+    private Map<Date, List<WeblogEntryWrapper>> entries = null;
     
     // are there more pages?
     private boolean more = false;
@@ -64,11 +64,11 @@ public class WeblogEntriesMonthPager ext
             String             pageLink,
             String             entryAnchor,
             String             dateString,
-            String             catPath,
+            String             catName,
             List               tags,
             int                page) {
         
-        super(strat, weblog, locale, pageLink, entryAnchor, dateString, catPath, tags, page);
+        super(strat, weblog, locale, pageLink, entryAnchor, dateString, catName, tags, page);
         
         monthFormat = new SimpleDateFormat(
             messageUtils.getString("weblogEntriesPager.month.dateFormat"));
@@ -97,7 +97,7 @@ public class WeblogEntriesMonthPager ext
     }
     
     
-    public Map getEntries() {
+    public Map<Date, List<WeblogEntryWrapper>> getEntries() {
         Date date = parseDate(dateString);
         Calendar cal = Calendar.getInstance(weblog.getTimeZoneInstance());
         cal.setTime(date);
@@ -107,40 +107,38 @@ public class WeblogEntriesMonthPager ext
         Date endDate = DateUtil.getEndOfMonth(date, cal);
         
         if (entries == null) {
-            entries = new TreeMap(new ReverseComparator());
+            entries = new TreeMap<Date, List<WeblogEntryWrapper>>(new ReverseComparator());
             try {
-                Map mmap = WebloggerFactory.getWeblogger().getWeblogEntryManager().getWeblogEntryObjectMap(
-                        
-                        weblog,
-                        startDate,
-                        endDate,
-                        catPath,
-                        tags,WeblogEntry.PUBLISHED, 
-                        locale,
-                        offset,  
-                        length + 1);
-                              
+                WeblogEntrySearchCriteria wesc = new WeblogEntrySearchCriteria();
+                wesc.setWeblog(weblog);
+                wesc.setStartDate(startDate);
+                wesc.setEndDate(endDate);
+                wesc.setCatName(catName);
+                wesc.setTags(tags);
+                wesc.setStatus(WeblogEntry.PUBLISHED);
+                wesc.setLocale(locale);
+                wesc.setOffset(offset);
+                wesc.setMaxResults(length+1);
+                Map<Date, List<WeblogEntry>> mmap = WebloggerFactory.getWeblogger()
+                        .getWeblogEntryManager().getWeblogEntryObjectMap(wesc);
+
                 // need to wrap pojos
                 int count = 0;
-                java.util.Date key = null;
-                Iterator days = mmap.keySet().iterator();
-                while(days.hasNext()) {
-                    key = (java.util.Date)days.next();
-
+                for (Map.Entry<Date, List<WeblogEntry>> entry : mmap.entrySet()) {
                     // now we need to go through each entry in a day and wrap
-                    List wrapped = new ArrayList();
-                    List unwrapped= (List) mmap.get(key);
-                    for(int i=0; i < unwrapped.size(); i++) {
+                    List<WeblogEntryWrapper> wrapped = new ArrayList<WeblogEntryWrapper>();
+                    List<WeblogEntry> unwrapped = entry.getValue();
+                    for (int i=0; i < unwrapped.size(); i++) {
                         if (count++ < length) {
-                            wrapped.add(i,WeblogEntryWrapper.wrap((WeblogEntry)unwrapped.get(i), urlStrategy));
+                            wrapped.add(i,WeblogEntryWrapper.wrap(unwrapped.get(i), urlStrategy));
                         } else {
                             more = true;
                         }
                     }
                     
                     // done with that day, put it in the map
-                    if(wrapped.size() > 0) {
-                        entries.put(key, wrapped);
+                    if (wrapped.size() > 0) {
+                        entries.put(entry.getKey(), wrapped);
                     }
                 }
             } catch (Exception e) {
@@ -152,7 +150,7 @@ public class WeblogEntriesMonthPager ext
     
     
     public String getHomeLink() {
-        return createURL(0, 0, weblog, locale, pageLink, null, null, catPath, tags);
+        return createURL(0, 0, weblog, locale, pageLink, null, null, catName, tags);
     }
     
     
@@ -163,7 +161,7 @@ public class WeblogEntriesMonthPager ext
     
     public String getNextLink() {
         if (more) {
-            return createURL(page, 1, weblog, locale, pageLink, null, dateString, catPath, tags);
+            return createURL(page, 1, weblog, locale, pageLink, null, dateString, catName, tags);
         }
         return null;
     }
@@ -179,7 +177,7 @@ public class WeblogEntriesMonthPager ext
     
     public String getPrevLink() {
         if (offset > 0) {
-            return createURL(page, -1, weblog, locale, pageLink, null, dateString, catPath, tags);
+            return createURL(page, -1, weblog, locale, pageLink, null, dateString, catName, tags);
         }
         return null;
     }
@@ -196,7 +194,7 @@ public class WeblogEntriesMonthPager ext
     public String getNextCollectionLink() {
         if (nextMonth != null) {
             String next = DateUtil.format6chars(nextMonth);
-            return createURL(0, 0, weblog, locale, pageLink, null, next, catPath, tags);
+            return createURL(0, 0, weblog, locale, pageLink, null, next, catName, tags);
         }
         return null;
     }
@@ -213,7 +211,7 @@ public class WeblogEntriesMonthPager ext
     public String getPrevCollectionLink() {
         if (prevMonth != null) {
             String prev = DateUtil.format6chars(prevMonth);
-            return createURL(0, 0, weblog, locale, pageLink, null, prev, catPath, tags);
+            return createURL(0, 0, weblog, locale, pageLink, null, prev, catName, tags);
         }
         return null;
     }

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesPermalinkPager.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesPermalinkPager.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesPermalinkPager.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesPermalinkPager.java Sun Apr 20 13:38:51 2014
@@ -58,11 +58,11 @@ public class WeblogEntriesPermalinkPager
             String             pageLink,
             String             entryAnchor,
             String             dateString,
-            String             catPath,
+            String             catName,
             List               tags,
             int                page) {
         
-        super(strat, weblog, locale, pageLink, entryAnchor, dateString, catPath, tags, page);
+        super(strat, weblog, locale, pageLink, entryAnchor, dateString, catName, tags, page);
         
         getEntries();
     }
@@ -90,7 +90,7 @@ public class WeblogEntriesPermalinkPager
     
     
     public String getHomeLink() {
-        return createURL(0, 0, weblog, locale, pageLink, null, dateString, catPath, tags);
+        return createURL(0, 0, weblog, locale, pageLink, null, dateString, catName, tags);
     }
     
     
@@ -101,7 +101,7 @@ public class WeblogEntriesPermalinkPager
     
     public String getNextLink() {
         if (getNextEntry() != null) {
-            return createURL(0, 0, weblog, locale, pageLink, nextEntry.getAnchor(), dateString, catPath, tags);
+            return createURL(0, 0, weblog, locale, pageLink, nextEntry.getAnchor(), dateString, catName, tags);
         }
         return null;
     }
@@ -118,7 +118,7 @@ public class WeblogEntriesPermalinkPager
     
     public String getPrevLink() {
         if (getPrevEntry() != null) {
-            return createURL(0, 0, weblog, locale, pageLink, prevEntry.getAnchor(), dateString, catPath, tags);
+            return createURL(0, 0, weblog, locale, pageLink, prevEntry.getAnchor(), dateString, catName, tags);
         }
         return null;
     }

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesPreviewPager.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesPreviewPager.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesPreviewPager.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesPreviewPager.java Sun Apr 20 13:38:51 2014
@@ -53,11 +53,11 @@ public class WeblogEntriesPreviewPager e
             String             pageLink,
             String             entryAnchor,
             String             dateString,
-            String             catPath,
+            String             catName,
             List               tags,
             int                page) {
         
-        super(strat, weblog, locale, pageLink, entryAnchor, dateString, catPath, tags, page);
+        super(strat, weblog, locale, pageLink, entryAnchor, dateString, catName, tags, page);
     }
     
     

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogsPager.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogsPager.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogsPager.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogsPager.java Sun Apr 20 13:38:51 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.logging.Log;
@@ -43,12 +42,11 @@ public class WeblogsPager extends Abstra
     private static Log log = LogFactory.getLog(WeblogsPager.class);
     
     private String letter = null;
-    private String locale = null;
     private int sinceDays = -1;
     private int length = 0;
     
     // collection for the pager
-    private List weblogs;
+    private List<WeblogWrapper> weblogs;
     
     // are there more items?
     private boolean more = false;
@@ -64,7 +62,6 @@ public class WeblogsPager extends Abstra
         
         super(strat, baseUrl, page);
         
-        this.locale = locale;
         this.sinceDays = sinceDays;
         this.length = length;
         
@@ -85,7 +82,6 @@ public class WeblogsPager extends Abstra
         super(strat, baseUrl, page);
         
         this.letter = letter;
-        this.locale = locale;
         this.sinceDays = sinceDays;
         this.length = length;
         
@@ -99,7 +95,7 @@ public class WeblogsPager extends Abstra
         if(letter != null) {
             int page = getPage() + 1;
             if(hasMoreItems()) {
-                Map params = new HashMap();
+                Map<String, String> params = new HashMap<String, String>();
                 params.put("page", ""+page);
                 params.put("letter", letter);
                 return createURL(getUrl(), params);
@@ -116,7 +112,7 @@ public class WeblogsPager extends Abstra
         if(letter != null) {
             int page = getPage() - 1;
             if (page >= 0) {
-                Map params = new HashMap();
+                Map<String, String> params = new HashMap<String, String>();
                 params.put("page", ""+page);
                 params.put("letter", letter);
                 return createURL(getUrl(), params);
@@ -128,13 +124,13 @@ public class WeblogsPager extends Abstra
     }
     
     
-    public List getItems() {
+    public List<WeblogWrapper> getItems() {
         
         if (weblogs == null) {
             // calculate offset
             int offset = getPage() * length;
             
-            List results = new ArrayList();
+            List<WeblogWrapper> results = new ArrayList<WeblogWrapper>();
             Date startDate = null;
             if (sinceDays != -1) {
                 Calendar cal = Calendar.getInstance();
@@ -145,7 +141,7 @@ public class WeblogsPager extends Abstra
             try {
                 Weblogger roller = WebloggerFactory.getWeblogger();
                 WeblogManager wmgr = roller.getWeblogManager();
-                List rawWeblogs = null;
+                List<Weblog> rawWeblogs;
                 if (letter == null) {
                     rawWeblogs = wmgr.getWeblogs(Boolean.TRUE, Boolean.TRUE, startDate, null, offset, length + 1);
                 } else {
@@ -154,10 +150,9 @@ public class WeblogsPager extends Abstra
                 
                 // wrap the results
                 int count = 0;
-                for (Iterator it = rawWeblogs.iterator(); it.hasNext();) {
-                    Weblog website = (Weblog) it.next();
+                for (Weblog website : rawWeblogs) {
                     if (count++ < length) {
-                        results.add(WeblogWrapper.wrap(website, urlStrategy));                    
+                        results.add(WeblogWrapper.wrap(website, urlStrategy));
                     } else {
                         more = true;
                     }

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/AkismetCommentValidator.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/AkismetCommentValidator.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/AkismetCommentValidator.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/AkismetCommentValidator.java Sun Apr 20 13:38:51 2014
@@ -26,6 +26,7 @@ import java.net.URLConnection;
 import java.util.ResourceBundle;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.roller.util.RollerConstants;
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.config.WebloggerConfig;
 import org.apache.roller.weblogger.pojos.WeblogEntryComment;
@@ -87,12 +88,13 @@ public class AkismetCommentValidator imp
                 return 0;
             }
             else {
-                return 100;
+                return RollerConstants.PERCENT_100;
             }
         } catch (Exception e) {
             log.error("ERROR checking comment against Akismet", e);
         }
-        return 0; // interpret error as spam: better safe than sorry? 
+        // interpreting error as spam: better safe than sorry?
+        return 0;
     }
 }
 

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/BlacklistCommentValidator.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/BlacklistCommentValidator.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/BlacklistCommentValidator.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/BlacklistCommentValidator.java Sun Apr 20 13:38:51 2014
@@ -19,6 +19,8 @@
 package org.apache.roller.weblogger.ui.rendering.plugins.comments;
 
 import java.util.ResourceBundle;
+
+import org.apache.roller.util.RollerConstants;
 import org.apache.roller.weblogger.pojos.WeblogEntryComment;
 import org.apache.roller.weblogger.util.RollerMessages;
 import org.apache.roller.weblogger.util.BlacklistChecker;
@@ -28,7 +30,6 @@ import org.apache.roller.weblogger.util.
  */
 public class BlacklistCommentValidator implements CommentValidator {
     private ResourceBundle bundle = ResourceBundle.getBundle("ApplicationResources");       
-    private BlacklistChecker checker = new BlacklistChecker();
 
     public String getName() {
         return bundle.getString("comment.validator.blacklistName");
@@ -39,7 +40,7 @@ public class BlacklistCommentValidator i
             messages.addError("comment.validator.blacklistMessage");
             return 0;
         }
-        return 100; 
+        return RollerConstants.PERCENT_100;
     }
     
 }

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/CommentValidationManager.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/CommentValidationManager.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/CommentValidationManager.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/CommentValidationManager.java Sun Apr 20 13:38:51 2014
@@ -19,11 +19,10 @@
 package org.apache.roller.weblogger.ui.rendering.plugins.comments;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
-import java.util.ResourceBundle;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.roller.util.RollerConstants;
 import org.apache.roller.weblogger.config.WebloggerConfig;
 import org.apache.roller.weblogger.pojos.WeblogEntryComment;
 import org.apache.roller.weblogger.util.RollerMessages;
@@ -33,28 +32,27 @@ import org.apache.roller.weblogger.util.
  * Responsible for loading validators and using them to validate comments.
  */
 public class CommentValidationManager {
-    private static Log     log = LogFactory.getLog(CommentValidationManager.class);
-    private ResourceBundle bundle = ResourceBundle.getBundle("ApplicationResources");
-    private List           validators = new ArrayList();
-    
+    private static Log log = LogFactory.getLog(CommentValidationManager.class);
+    private List<CommentValidator> validators = new ArrayList<CommentValidator>();
+
     public CommentValidationManager() {
         
         // instantiate the validators that are configured
         try {
             String vals = WebloggerConfig.getProperty("comment.validator.classnames");
             String[] valsarray = Utilities.stringToStringArray(vals, ",");
-            for(int i=0; i < valsarray.length; i++) {
+            for (String arrayVal : valsarray) {
                 try {
-                    Class valClass = Class.forName(valsarray[i]);
-                    CommentValidator val = (CommentValidator)valClass.newInstance();
+                    Class valClass = Class.forName(arrayVal);
+                    CommentValidator val = (CommentValidator) valClass.newInstance();
                     validators.add(val);
                     log.info("Configured CommentValidator: " + val.getName() + " / " + valClass.getName());
                 } catch (ClassNotFoundException cnfe) {
-                    log.warn("Error finding comment validator: " + valsarray[i]);
+                    log.warn("Error finding comment validator: " + arrayVal);
                 } catch (InstantiationException ie) {
-                    log.warn("Error insantiating comment validator: " + valsarray[i]);
+                    log.warn("Error insantiating comment validator: " + arrayVal);
                 } catch (IllegalAccessException iae) {
-                    log.warn("Error accessing comment validator: " + valsarray[i]);
+                    log.warn("Error accessing comment validator: " + arrayVal);
                 }
             }
                         
@@ -72,13 +70,6 @@ public class CommentValidationManager {
     }
     
     /**
-     * Return total number of validators (for teasting purposes).
-     */
-    public int getValidatorCount() {
-        return validators.size();
-    }
-    
-    /**
      * @param comment Comment to be validated
      * @param messages Messages object to which errors will be added
      * @return Number indicating confidence that comment is valid (100 meaning 100%)
@@ -86,15 +77,14 @@ public class CommentValidationManager {
     public int validateComment(WeblogEntryComment comment, RollerMessages messages) {
         int total = 0;
         if (validators.size() > 0) {
-            for (Iterator it = validators.iterator(); it.hasNext();) {
-                CommentValidator val = (CommentValidator) it.next();
+            for (CommentValidator val : validators) {
                 log.debug("Invoking comment validator "+val.getName());
                 total += val.validate(comment, messages);
             }
             total = total / validators.size();
         } else {
             // When no validators: consider all comments valid
-            total = 100;
+            total = RollerConstants.PERCENT_100;
         }
         return total;
     }

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/ExcessLinksCommentValidator.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/ExcessLinksCommentValidator.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/ExcessLinksCommentValidator.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/ExcessLinksCommentValidator.java Sun Apr 20 13:38:51 2014
@@ -21,6 +21,8 @@ package org.apache.roller.weblogger.ui.r
 import java.util.ResourceBundle;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+
+import org.apache.roller.util.RollerConstants;
 import org.apache.roller.weblogger.config.WebloggerConfig;
 import org.apache.roller.weblogger.pojos.WeblogEntryComment;
 import org.apache.roller.weblogger.util.RollerMessages;
@@ -50,7 +52,7 @@ public class ExcessLinksCommentValidator
                 return 0;
             }
         }
-        return 100;
+        return RollerConstants.PERCENT_100;
     }
     
 }

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/ExcessSizeCommentValidator.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/ExcessSizeCommentValidator.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/ExcessSizeCommentValidator.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/ExcessSizeCommentValidator.java Sun Apr 20 13:38:51 2014
@@ -19,6 +19,8 @@
 package org.apache.roller.weblogger.ui.rendering.plugins.comments;
 
 import java.util.ResourceBundle;
+
+import org.apache.roller.util.RollerConstants;
 import org.apache.roller.weblogger.config.WebloggerConfig;
 import org.apache.roller.weblogger.pojos.WeblogEntryComment;
 import org.apache.roller.weblogger.util.RollerMessages;
@@ -43,7 +45,7 @@ public class ExcessSizeCommentValidator 
             messages.addError("comment.validator.excessSizeMessage", Integer.toString(threshold));
             return 0;
         }
-        return 100;
+        return RollerConstants.PERCENT_100;
     }
     
 }

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/LdapCommentAuthenticator.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/LdapCommentAuthenticator.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/LdapCommentAuthenticator.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/LdapCommentAuthenticator.java Sun Apr 20 13:38:51 2014
@@ -114,7 +114,7 @@ public class LdapCommentAuthenticator im
 		
 		if(rollerPropertiesValid && userDataValid){
 			try {
-				Hashtable<String,String> env = new Hashtable<String,String>();  
+				Hashtable<String,String> env = new Hashtable<String,String>();
 				env.put(Context.INITIAL_CONTEXT_FACTORY,  
 						"com.sun.jndi.ldap.LdapCtxFactory"); 
 				if(ldapSecurityLevel != null 
@@ -126,7 +126,7 @@ public class LdapCommentAuthenticator im
 				env.put(Context.SECURITY_PRINCIPAL,  getQualifedDc(ldapDc, ldapOu, ldapUser));  
 				env.put(Context.SECURITY_CREDENTIALS, ldapPass);
 				env.put(Context.PROVIDER_URL, "ldap://" + ldapHost + ":" + ldapPort);  
-				context = new InitialLdapContext(env, null);  
+				context = new InitialLdapContext(env, null);
 				validUser = true;
 				LOG.info("LDAP Authentication Successful. user: " + ldapUser);
 			} catch (Exception e) {
@@ -146,7 +146,7 @@ public class LdapCommentAuthenticator im
 	}
 
 	/**
-	 * Get the username string LDAP expects.
+	 * Get the qualified username string LDAP expects.
 	 * @param ldapDc
 	 * @param ldapOu
 	 * @param ldapUser
@@ -154,15 +154,14 @@ public class LdapCommentAuthenticator im
 	 */
 	private String getQualifedDc(String ldapDc, String ldapOu, String ldapUser) {
 		String qualifedDc = "";
-		for(String token : StringUtils.delimitedListToStringArray(ldapDc, ",")){
-			if(!qualifedDc.isEmpty()){
+		for (String token : StringUtils.delimitedListToStringArray(ldapDc, ",")) {
+			if (!qualifedDc.isEmpty()) {
 				qualifedDc += ",";
 			}
 			qualifedDc += "dc=" + token;
 		}
 		
-		String qualifedUser = "uid=" + ldapUser + ", ou=" + ldapOu + "," + qualifedDc;
-		return qualifedUser;
+		return "uid=" + ldapUser + ", ou=" + ldapOu + "," + qualifedDc;
 	}
 
 	/**

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/MathCommentAuthenticator.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/MathCommentAuthenticator.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/MathCommentAuthenticator.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/MathCommentAuthenticator.java Sun Apr 20 13:38:51 2014
@@ -18,6 +18,7 @@
 
 package org.apache.roller.weblogger.ui.rendering.plugins.comments;
 
+import java.util.Random;
 import java.util.ResourceBundle;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
@@ -43,8 +44,9 @@ public class MathCommentAuthenticator im
         HttpSession session = request.getSession(true);
         if (session.getAttribute("mathAnswer") == null) {
             // starting a new test
-            int value1 = (int)(Math.random()*10.0);
-            int value2 = (int)(Math.random()*100.0);
+            Random ran = new Random();
+            int value1 = ran.nextInt(10);
+            int value2 = ran.nextInt(100);
             int sum = value1 + value2;
             session.setAttribute("mathValue1", value1);
             session.setAttribute("mathValue2", value2);

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/TrackbackLinkbackCommentValidator.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/TrackbackLinkbackCommentValidator.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/TrackbackLinkbackCommentValidator.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/TrackbackLinkbackCommentValidator.java Sun Apr 20 13:38:51 2014
@@ -21,6 +21,8 @@ package org.apache.roller.weblogger.ui.r
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.util.ResourceBundle;
+
+import org.apache.roller.util.RollerConstants;
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
 import org.apache.roller.weblogger.pojos.WeblogEntryComment;
@@ -44,7 +46,7 @@ public class TrackbackLinkbackCommentVal
         // linkback validation can be toggled at runtime, so check if it's enabled
         // if it's disabled then just return a score of 100
         if(!WebloggerRuntimeConfig.getBooleanProperty("site.trackbackVerification.enabled")) {
-            return 100;
+            return RollerConstants.PERCENT_100;
         }
         
         int ret = 0;
@@ -61,7 +63,7 @@ public class TrackbackLinkbackCommentVal
         } catch (IOException ignored2) {}
         
         if (linkback != null && linkback.getExcerpt() != null) {
-            ret = 100;
+            ret = RollerConstants.PERCENT_100;
         } else {
             messages.addError("comment.validator.trackbackLinkbackMessage");
         }

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/CommentServlet.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/CommentServlet.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/CommentServlet.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/CommentServlet.java Sun Apr 20 13:38:51 2014
@@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpServletResponse;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.roller.util.RollerConstants;
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.config.WebloggerConfig;
 import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
@@ -97,11 +98,6 @@ public class CommentServlet extends Http
         // instantiate a comment validation manager for comment spam checking
         commentValidationManager = new CommentValidationManager();
 
-        // instantiate a comment format manager for comment formatting
-        String fmtrs = WebloggerConfig
-                .getProperty("comment.formatter.classnames");
-        String[] formatters = Utilities.stringToStringArray(fmtrs, ",");
-
         // are we doing throttling?
         if (WebloggerConfig.getBooleanProperty("comment.throttle.enabled")) {
 
@@ -115,12 +111,12 @@ public class CommentServlet extends Http
                         e);
             }
 
-            int interval = 60000;
+            int interval = RollerConstants.MIN_IN_MS;
             try {
                 interval = Integer.parseInt(WebloggerConfig
                         .getProperty("comment.throttle.interval"));
                 // convert from seconds to milliseconds
-                interval = interval * 1000;
+                interval = interval * RollerConstants.SEC_IN_MS;
             } catch (Exception e) {
                 log.warn(
                         "bad input for config property comment.throttle.interval",
@@ -167,10 +163,10 @@ public class CommentServlet extends Http
             throws IOException, ServletException {
 
         String error = null;
-        String dispatch_url = null;
+        String dispatch_url;
 
-        Weblog weblog = null;
-        WeblogEntry entry = null;
+        Weblog weblog;
+        WeblogEntry entry;
 
         String message = null;
         RollerMessages messages = new RollerMessages();
@@ -197,7 +193,7 @@ public class CommentServlet extends Http
             return;
         }
 
-        WeblogCommentRequest commentRequest = null;
+        WeblogCommentRequest commentRequest;
         try {
             commentRequest = new WeblogCommentRequest(request);
 
@@ -242,7 +238,7 @@ public class CommentServlet extends Http
         comment.setEmail(commentRequest.getEmail());
         comment.setUrl(commentRequest.getUrl());
         comment.setContent(commentRequest.getContent());
-        comment.setNotify(Boolean.valueOf(commentRequest.isNotify()));
+        comment.setNotify(commentRequest.isNotify());
         comment.setWeblogEntry(entry);
         comment.setRemoteHost(request.getRemoteHost());
         comment.setPostTime(new Timestamp(System.currentTimeMillis()));
@@ -304,12 +300,12 @@ public class CommentServlet extends Http
 
         if (!preview) {
 
-            if (validationScore == 100 && weblog.getCommentModerationRequired()) {
+            if (validationScore == RollerConstants.PERCENT_100 && weblog.getCommentModerationRequired()) {
                 // Valid comments go into moderation if required
                 comment.setStatus(WeblogEntryComment.PENDING);
                 message = messageUtils
                         .getString("commentServlet.submittedToModerator");
-            } else if (validationScore == 100) {
+            } else if (validationScore == RollerConstants.PERCENT_100) {
                 // else they're approved
                 comment.setStatus(WeblogEntryComment.APPROVED);
                 message = messageUtils
@@ -324,7 +320,7 @@ public class CommentServlet extends Http
                 // add specific error messages if they exist
                 if (messages.getErrorCount() > 0) {
                     Iterator errors = messages.getErrors();
-                    RollerMessage errorKey = null;
+                    RollerMessage errorKey;
 
                     StringBuilder buf = new StringBuilder();
                     buf.append("<ul>");
@@ -359,7 +355,7 @@ public class CommentServlet extends Http
 
                     // Send email notifications only to subscribers if comment
                     // is 100% valid
-                    boolean notifySubscribers = (validationScore == 100);
+                    boolean notifySubscribers = (validationScore == RollerConstants.PERCENT_100);
                     MailUtil.sendEmailNotification(comment, messages,
                             messageUtils, notifySubscribers);
 

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/FeedServlet.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/FeedServlet.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/FeedServlet.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/FeedServlet.java Sun Apr 20 13:38:51 2014
@@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpServletResponse;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.roller.util.RollerConstants;
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.business.WeblogEntryManager;
@@ -84,10 +85,10 @@ public class FeedServlet extends HttpSer
 
         log.debug("Entering");
 
-        Weblog weblog = null;
-        boolean isSiteWide = false;
+        Weblog weblog;
+        boolean isSiteWide;
 
-        WeblogFeedRequest feedRequest = null;
+        WeblogFeedRequest feedRequest;
         try {
             // parse the incoming request and extract the relevant data
             feedRequest = new WeblogFeedRequest(request);
@@ -146,7 +147,7 @@ public class FeedServlet extends HttpSer
         }
 
         // generate cache key
-        String cacheKey = null;
+        String cacheKey;
         if (isSiteWide) {
             cacheKey = siteWideCache.generateKey(feedRequest);
         } else {
@@ -154,7 +155,7 @@ public class FeedServlet extends HttpSer
         }
 
         // cached content checking
-        CachedContent cachedContent = null;
+        CachedContent cachedContent;
         if (isSiteWide) {
             cachedContent = (CachedContent) siteWideCache.get(cacheKey);
         } else {
@@ -214,8 +215,8 @@ public class FeedServlet extends HttpSer
         }
 
         // looks like we need to render content
-        HashMap model = new HashMap();
-        String pageId = null;
+        HashMap<String, Object> model = new HashMap<String, Object>();
+        String pageId;
         try {
             // determine what template to render with
             boolean siteWide = WebloggerRuntimeConfig.isSiteWideWeblog(weblog
@@ -238,7 +239,7 @@ public class FeedServlet extends HttpSer
             }
 
             // populate the rendering model
-            Map initData = new HashMap();
+            Map<String, Object> initData = new HashMap<String, Object>();
             initData.put("parsedRequest", feedRequest);
 
             // define url strategy
@@ -279,7 +280,7 @@ public class FeedServlet extends HttpSer
         }
 
         // lookup Renderer we are going to use
-        Renderer renderer = null;
+        Renderer renderer;
         try {
             log.debug("Looking up renderer");
             Template template = new StaticTemplate(pageId, "velocity");
@@ -304,8 +305,8 @@ public class FeedServlet extends HttpSer
             return;
         }
 
-        // render content. use default size of about 24K for a standard page
-        CachedContent rendererOutput = new CachedContent(24567);
+        // render content. use default size of 24K for a standard page
+        CachedContent rendererOutput = new CachedContent(RollerConstants.TWENTYFOUR_KB_IN_BYTES);
         try {
             log.debug("Doing rendering");
             renderer.render(model, rendererOutput.getCachedWriter());

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/MediaResourceServlet.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/MediaResourceServlet.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/MediaResourceServlet.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/MediaResourceServlet.java Sun Apr 20 13:38:51 2014
@@ -30,6 +30,7 @@ import javax.servlet.http.HttpServletRes
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.roller.util.RollerConstants;
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.MediaFileManager;
 import org.apache.roller.weblogger.business.WebloggerFactory;
@@ -65,12 +66,9 @@ public class MediaResourceServlet extend
         MediaFileManager mfMgr = WebloggerFactory.getWeblogger()
                 .getMediaFileManager();
 
-        Weblog weblog = null;
-        String ctx = request.getContextPath();
-        String servlet = request.getServletPath();
-        String reqURI = request.getRequestURI();
+        Weblog weblog;
 
-        WeblogMediaResourceRequest resourceRequest = null;
+        WeblogMediaResourceRequest resourceRequest;
         try {
             // parse the incoming request and extract the relevant data
             resourceRequest = new WeblogMediaResourceRequest(request);
@@ -88,9 +86,9 @@ public class MediaResourceServlet extend
             return;
         }
 
-        long resourceLastMod = 0;
+        long resourceLastMod;
         InputStream resourceStream = null;
-        MediaFile mediaFile = null;
+        MediaFile mediaFile;
 
         try {
             mediaFile = mfMgr.getMediaFile(resourceRequest.getResourceId(),
@@ -135,11 +133,11 @@ public class MediaResourceServlet extend
             resourceStream = mediaFile.getInputStream();
         }
 
-        OutputStream out = null;
+        OutputStream out;
         try {
             // ok, lets serve up the file
-            byte[] buf = new byte[8192];
-            int length = 0;
+            byte[] buf = new byte[RollerConstants.EIGHT_KB_IN_BYTES];
+            int length;
             out = response.getOutputStream();
             while ((length = resourceStream.read(buf)) > 0) {
                 out.write(buf, 0, length);

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PageServlet.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PageServlet.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PageServlet.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PageServlet.java Sun Apr 20 13:38:51 2014
@@ -18,9 +18,10 @@
 
 package org.apache.roller.weblogger.ui.rendering.servlets;
 
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.roller.util.RollerConstants;
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.HitCountQueue;
 import org.apache.roller.weblogger.business.WeblogEntryManager;
@@ -148,10 +149,10 @@ public class PageServlet extends HttpSer
             }
         }
 
-        Weblog weblog = null;
-        boolean isSiteWide = false;
+        Weblog weblog;
+        boolean isSiteWide;
 
-        WeblogPageRequest pageRequest = null;
+        WeblogPageRequest pageRequest;
         try {
             pageRequest = new WeblogPageRequest(request);
 
@@ -194,7 +195,7 @@ public class PageServlet extends HttpSer
         }
 
         // generate cache key
-        String cacheKey = null;
+        String cacheKey;
         if (isSiteWide) {
             cacheKey = siteWideCache.generateKey(pageRequest);
         } else {
@@ -206,7 +207,8 @@ public class PageServlet extends HttpSer
                 && !weblog.getEditorTheme()
                         .equals(WeblogTemplate.ACTION_CUSTOM)
                 && (pageRequest.getPathInfo() == null || pageRequest
-                        .getPathInfo() != null)) {
+                        .getPathInfo() != null
+                        && !pageRequest.getPathInfo().endsWith(".css"))) {
             try {
                 ThemeManager manager = WebloggerFactory.getWeblogger()
                         .getThemeManager();
@@ -230,7 +232,7 @@ public class PageServlet extends HttpSer
         if ((!this.excludeOwnerPages || !pageRequest.isLoggedIn())
                 && request.getAttribute("skipCache") == null) {
 
-            CachedContent cachedContent = null;
+            CachedContent cachedContent;
             if (isSiteWide) {
                 cachedContent = (CachedContent) siteWideCache.get(cacheKey);
             } else {
@@ -243,8 +245,7 @@ public class PageServlet extends HttpSer
 
                 // allow for hit counting
                 if (!isSiteWide) {
-                    this.processHit(weblog, request.getRequestURL().toString(),
-                            request.getHeader("referer"));
+                    this.processHit(weblog);
                 }
 
                 response.setContentLength(cachedContent.getContent().length);
@@ -349,12 +350,9 @@ public class PageServlet extends HttpSer
         if (pageRequest.getWeblogPageName() != null && page.isHidden()) {
             invalid = true;
         }
-        if (pageRequest.getLocale() != null) {
-
-            // locale view only allowed if weblog has enabled it
-            if (!pageRequest.getWeblog().isEnableMultiLang()) {
-                invalid = true;
-            }
+        // locale view allowed only if weblog has enabled it
+        if (pageRequest.getLocale() != null && !pageRequest.getWeblog().isEnableMultiLang()) {
+            invalid = true;
         }
         if (pageRequest.getWeblogAnchor() != null) {
 
@@ -408,13 +406,12 @@ public class PageServlet extends HttpSer
 
         // allow for hit counting
         if (!isSiteWide) {
-            this.processHit(weblog, request.getRequestURL().toString(),
-                    request.getHeader("referer"));
+            this.processHit(weblog);
         }
 
         // looks like we need to render content
         // set the content deviceType
-        String contentType = "text/html; charset=utf-8";
+        String contentType;
         if (StringUtils.isNotEmpty(page.getOutputContentType())) {
             contentType = page.getOutputContentType() + "; charset=utf-8";
         } else {
@@ -428,17 +425,17 @@ public class PageServlet extends HttpSer
             }
         }
 
-        HashMap model = new HashMap();
+        HashMap<String, Object> model = new HashMap<String, Object>();
         try {
             PageContext pageContext = JspFactory.getDefaultFactory()
-                    .getPageContext(this, request, response, "", false, 8192,
+                    .getPageContext(this, request, response, "", false, RollerConstants.EIGHT_KB_IN_BYTES,
                             true);
 
             // special hack for menu tag
             request.setAttribute("pageRequest", pageRequest);
 
             // populate the rendering model
-            Map initData = new HashMap();
+            Map<String, Object> initData = new HashMap<String, Object>();
             initData.put("requestParameters", request.getParameterMap());
             initData.put("parsedRequest", pageRequest);
             initData.put("pageContext", pageContext);
@@ -479,7 +476,7 @@ public class PageServlet extends HttpSer
         }
 
         // lookup Renderer we are going to use
-        Renderer renderer = null;
+        Renderer renderer;
         try {
             log.debug("Looking up renderer");
             renderer = RendererManager.getRenderer(page,
@@ -495,8 +492,8 @@ public class PageServlet extends HttpSer
             return;
         }
 
-        // render content. use size of about 24K for a standard page
-        CachedContent rendererOutput = new CachedContent(24567, contentType);
+        // render content
+        CachedContent rendererOutput = new CachedContent(RollerConstants.TWENTYFOUR_KB_IN_BYTES, contentType);
         try {
             log.debug("Doing rendering");
             renderer.render(model, rendererOutput.getCachedWriter());
@@ -561,10 +558,10 @@ public class PageServlet extends HttpSer
     /**
      * Notify the hit tracker that it has an incoming page hit.
      */
-    private void processHit(Weblog weblog, String url, String referrer) {
+    private void processHit(Weblog weblog) {
 
         HitCountQueue counter = HitCountQueue.getInstance();
-        counter.processHit(weblog, url, referrer);
+        counter.processHit(weblog);
     }
 
     /**
@@ -622,7 +619,7 @@ public class PageServlet extends HttpSer
         }
 
         // validate the referrer
-        if (pageRequest != null && pageRequest.getWeblogHandle() != null) {
+        if (pageRequest.getWeblogHandle() != null) {
 
             // Base page URLs, with and without www.
             String basePageUrlWWW = WebloggerRuntimeConfig

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PlanetFeedServlet.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PlanetFeedServlet.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PlanetFeedServlet.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PlanetFeedServlet.java Sun Apr 20 13:38:51 2014
@@ -28,9 +28,10 @@ import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.roller.util.RollerConstants;
 import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
 import org.apache.roller.planet.business.PlanetManager;
 import org.apache.roller.planet.pojos.Planet;
@@ -202,8 +203,8 @@ public class PlanetFeedServlet extends H
             return;
         }
 
-        // render content. use default size of about 24K for a standard page
-        CachedContent rendererOutput = new CachedContent(24567);
+        // render content
+        CachedContent rendererOutput = new CachedContent(RollerConstants.TWENTYFOUR_KB_IN_BYTES);
         try {
             log.debug("Doing rendering");
             renderer.render(model, rendererOutput.getCachedWriter());

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PreviewResourceServlet.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PreviewResourceServlet.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PreviewResourceServlet.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PreviewResourceServlet.java Sun Apr 20 13:38:51 2014
@@ -27,9 +27,10 @@ import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.roller.util.RollerConstants;
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.MediaFileManager;
 import org.apache.roller.weblogger.business.WebloggerFactory;
@@ -68,12 +69,9 @@ public class PreviewResourceServlet exte
     public void doGet(HttpServletRequest request, HttpServletResponse response)
             throws ServletException, IOException {
 
-        Weblog weblog = null;
-        String ctx = request.getContextPath();
-        String servlet = request.getServletPath();
-        String reqURI = request.getRequestURI();
+        Weblog weblog;
 
-        WeblogPreviewResourceRequest resourceRequest = null;
+        WeblogPreviewResourceRequest resourceRequest;
         try {
             // parse the incoming request and extract the relevant data
             resourceRequest = new WeblogPreviewResourceRequest(request);
@@ -159,11 +157,11 @@ public class PreviewResourceServlet exte
         response.setContentType(this.context.getMimeType(resourceRequest
                 .getResourcePath()));
 
-        OutputStream out = null;
+        OutputStream out;
         try {
             // ok, lets serve up the file
-            byte[] buf = new byte[8192];
-            int length = 0;
+            byte[] buf = new byte[RollerConstants.EIGHT_KB_IN_BYTES];
+            int length;
             out = response.getOutputStream();
             while ((length = resourceStream.read(buf)) > 0) {
                 out.write(buf, 0, length);



Mime
View raw message