roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r583952 - in /roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2: admin/GlobalCommentManagement.java editor/Comments.java
Date Thu, 11 Oct 2007 21:03:57 GMT
Author: snoopdave
Date: Thu Oct 11 14:03:56 2007
New Revision: 583952

URL: http://svn.apache.org/viewvc?rev=583952&view=rev
Log:
Fixing a couple more attempt to use deleted object bugs

Modified:
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/admin/GlobalCommentManagement.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Comments.java

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/admin/GlobalCommentManagement.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/admin/GlobalCommentManagement.java?rev=583952&r1=583951&r2=583952&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/admin/GlobalCommentManagement.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/admin/GlobalCommentManagement.java
Thu Oct 11 14:03:56 2007
@@ -31,6 +31,7 @@
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.business.WeblogManager;
+import org.apache.roller.weblogger.pojos.Weblog;
 import org.apache.roller.weblogger.pojos.WeblogEntryComment;
 import org.apache.roller.weblogger.ui.struts2.pagers.CommentsPager;
 import org.apache.roller.weblogger.ui.struts2.util.KeyValueObject;
@@ -242,7 +243,7 @@
         try {
             WeblogManager wmgr = WebloggerFactory.getWeblogger().getWeblogManager();
             
-            List flushList = new ArrayList();
+            List<Weblog> flushList = new ArrayList<Weblog>();
             
             // delete all comments with delete box checked
             List<String> deletes = Arrays.asList(getBean().getDeleteComments());
@@ -252,8 +253,8 @@
                 WeblogEntryComment deleteComment = null;
                 for(String deleteId : deletes) {
                     deleteComment = wmgr.getComment(deleteId);
+                    flushList.add(deleteComment.getWeblogEntry().getWebsite());
                     wmgr.removeComment(deleteComment);
-                    flushList.add(deleteComment);
                 }
             }
             
@@ -280,21 +281,21 @@
                     comment.setStatus(WeblogEntryComment.SPAM);
                     wmgr.saveComment(comment);
                     
-                    flushList.add(comment);
+                    flushList.add(comment.getWeblogEntry().getWebsite());
                 } else if(WeblogEntryComment.SPAM.equals(comment.getStatus())) {
                     log.debug("Marking as approved - "+comment.getId());
                     comment.setStatus(WeblogEntryComment.APPROVED);
                     wmgr.saveComment(comment);
                     
-                    flushList.add(comment);
+                    flushList.add(comment.getWeblogEntry().getWebsite());
                 }
             }
             
             WebloggerFactory.getWeblogger().flush();
             
-            // notify caches of changes
-            for (Iterator comments=flushList.iterator(); comments.hasNext();) {
-                CacheManager.invalidate((WeblogEntryComment)comments.next());
+            // notify caches of changes, flush weblogs affected by changes
+            for (Iterator sites = flushList.iterator(); sites.hasNext();) {
+                CacheManager.invalidate((Weblog)sites.next());
             }
             
             addMessage("commentManagement.updateSuccess");

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Comments.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Comments.java?rev=583952&r1=583951&r2=583952&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Comments.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Comments.java
Thu Oct 11 14:03:56 2007
@@ -362,10 +362,9 @@
             
             WebloggerFactory.getWeblogger().flush();
             
-            // notify caches of changes
-            for(WeblogEntryComment comm : flushList) {
-                CacheManager.invalidate(comm);
-            }
+            // notify caches of changes by flushing whole site because we can't
+            // invalidate deleted comment objects (JPA nulls the fields out).
+            CacheManager.invalidate(getActionWeblog());
             
             // send notification for all comments changed
             if (MailUtil.isMailConfigured()) {



Mime
View raw message