roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r471955 - /incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesPreviewPager.java
Date Tue, 07 Nov 2006 01:13:44 GMT
Author: agilliland
Date: Mon Nov  6 17:13:43 2006
New Revision: 471955

URL: http://svn.apache.org/viewvc?view=rev&rev=471955
Log:
fixing bug in previewing caused by the fact that the entry pubTime is null for entries which
are DRAFT or PENDING.  to remedy the problem we are making a copy of the draft entry object
and setting the pubtime to the current time.


Modified:
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesPreviewPager.java

Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesPreviewPager.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesPreviewPager.java?view=diff&rev=471955&r1=471954&r2=471955
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesPreviewPager.java
(original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesPreviewPager.java
Mon Nov  6 17:13:43 2006
@@ -18,6 +18,7 @@
 
 package org.apache.roller.ui.rendering.pagers;
 
+import java.sql.Timestamp;
 import java.util.Collections;
 import java.util.Date;
 import java.util.List;
@@ -28,6 +29,7 @@
 import org.apache.roller.business.Roller;
 import org.apache.roller.business.RollerFactory;
 import org.apache.roller.business.WeblogManager;
+import org.apache.roller.pojos.WeblogEntryData;
 import org.apache.roller.pojos.WebsiteData;
 import org.apache.roller.pojos.wrapper.WeblogEntryDataWrapper;
 
@@ -64,16 +66,20 @@
             WeblogManager wmgr = roller.getWeblogManager();
             currEntry = wmgr.getWeblogEntryByAnchor(weblog, entryAnchor);
             if (currEntry != null) {
-                entries = new TreeMap();
                 
-                // if entry is not published then pubtime may be null
-                Date pubtime = currEntry.getPubTime();
-                if(pubtime == null) {
-                    pubtime = new Date();
+                // clone the entry since we don't want to work with the real pojo
+                WeblogEntryData tmpEntry = new WeblogEntryData();
+                tmpEntry.setData(currEntry);
+                
+                // set the pubtime to the current time if it is unset
+                if(tmpEntry.getPubTime() == null) {
+                    tmpEntry.setPubTime(new Timestamp(System.currentTimeMillis()));
                 }
                 
-                entries.put(pubtime,
-                        Collections.singletonList(WeblogEntryDataWrapper.wrap(currEntry)));
+                // store the entry in the collection
+                entries = new TreeMap();
+                entries.put(tmpEntry.getPubTime(),
+                        Collections.singletonList(WeblogEntryDataWrapper.wrap(tmpEntry)));
             }
         } catch (Exception e) {
             log.error("ERROR: fetching entry", e);



Mime
View raw message