roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r471956 - in /incubator/roller/branches/roller_3.1/src/org/apache/roller/ui: core/tags/menu/ rendering/model/ rendering/pagers/ rendering/velocity/deprecated/
Date Tue, 07 Nov 2006 01:17:20 GMT
Author: agilliland
Date: Mon Nov  6 17:17:19 2006
New Revision: 471956

URL: http://svn.apache.org/viewvc?view=rev&rev=471956
Log:
merging in changes from trunk revisions 471950 and 471955 which fix some bugs cause by null
RollerSession objects and fixes a bug in entry previewing.


Modified:
    incubator/roller/branches/roller_3.1/src/org/apache/roller/ui/core/tags/menu/EditorNavigationBarTag.java
    incubator/roller/branches/roller_3.1/src/org/apache/roller/ui/rendering/model/UtilitiesModel.java
    incubator/roller/branches/roller_3.1/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesPreviewPager.java
    incubator/roller/branches/roller_3.1/src/org/apache/roller/ui/rendering/velocity/deprecated/OldWeblogPageModel.java

Modified: incubator/roller/branches/roller_3.1/src/org/apache/roller/ui/core/tags/menu/EditorNavigationBarTag.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.1/src/org/apache/roller/ui/core/tags/menu/EditorNavigationBarTag.java?view=diff&rev=471956&r1=471955&r2=471956
==============================================================================
--- incubator/roller/branches/roller_3.1/src/org/apache/roller/ui/core/tags/menu/EditorNavigationBarTag.java
(original)
+++ incubator/roller/branches/roller_3.1/src/org/apache/roller/ui/core/tags/menu/EditorNavigationBarTag.java
Mon Nov  6 17:17:19 2006
@@ -46,7 +46,7 @@
             HttpServletRequest request =
                     (HttpServletRequest)pageContext.getRequest();
             RollerSession rollerSession = RollerSession.getRollerSession(request);
-            if ( rollerSession.isGlobalAdminUser() ) {
+            if ( rollerSession != null && rollerSession.isGlobalAdminUser() ) {
                 return super.doEndTag(pw);
             } else {
                 return EVAL_PAGE;

Modified: incubator/roller/branches/roller_3.1/src/org/apache/roller/ui/rendering/model/UtilitiesModel.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.1/src/org/apache/roller/ui/rendering/model/UtilitiesModel.java?view=diff&rev=471956&r1=471955&r2=471956
==============================================================================
--- incubator/roller/branches/roller_3.1/src/org/apache/roller/ui/rendering/model/UtilitiesModel.java
(original)
+++ incubator/roller/branches/roller_3.1/src/org/apache/roller/ui/rendering/model/UtilitiesModel.java
Mon Nov  6 17:17:19 2006
@@ -120,7 +120,7 @@
     public boolean isUserAuthorizedToAuthor(WebsiteDataWrapper weblog) {
         try {
             RollerSession rses = RollerSession.getRollerSession(request);
-            if (rses.getAuthenticatedUser() != null) {
+            if (rses != null && rses.getAuthenticatedUser() != null) {
                 return rses.isUserAuthorizedToAuthor(weblog.getPojo());
             }
         } catch (Exception e) {
@@ -132,7 +132,7 @@
     public boolean isUserAuthorizedToAdmin(WebsiteDataWrapper weblog) {
         try {
             RollerSession rses = RollerSession.getRollerSession(request);
-            if (rses.getAuthenticatedUser() != null) {
+            if (rses != null && rses.getAuthenticatedUser() != null) {
                 return rses.isUserAuthorizedToAdmin(weblog.getPojo());
             }
         } catch (Exception e) {

Modified: incubator/roller/branches/roller_3.1/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesPreviewPager.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.1/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesPreviewPager.java?view=diff&rev=471956&r1=471955&r2=471956
==============================================================================
--- incubator/roller/branches/roller_3.1/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesPreviewPager.java
(original)
+++ incubator/roller/branches/roller_3.1/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesPreviewPager.java
Mon Nov  6 17:17:19 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);

Modified: incubator/roller/branches/roller_3.1/src/org/apache/roller/ui/rendering/velocity/deprecated/OldWeblogPageModel.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.1/src/org/apache/roller/ui/rendering/velocity/deprecated/OldWeblogPageModel.java?view=diff&rev=471956&r1=471955&r2=471956
==============================================================================
--- incubator/roller/branches/roller_3.1/src/org/apache/roller/ui/rendering/velocity/deprecated/OldWeblogPageModel.java
(original)
+++ incubator/roller/branches/roller_3.1/src/org/apache/roller/ui/rendering/velocity/deprecated/OldWeblogPageModel.java
Mon Nov  6 17:17:19 2006
@@ -722,7 +722,7 @@
         try {
             RollerSession rses =
                     RollerSession.getRollerSession(mRequest);
-            if (rses.getAuthenticatedUser() != null && mWebsite != null) {
+            if (rses != null && rses.getAuthenticatedUser() != null && mWebsite
!= null) {
                 return rses.isUserAuthorizedToAuthor(mWebsite);
             }
         } catch (Exception e) {
@@ -737,7 +737,7 @@
         try {
             RollerSession rses =
                     RollerSession.getRollerSession(mRequest);
-            if (rses.getAuthenticatedUser() != null && mWebsite != null) {
+            if (rses != null && rses.getAuthenticatedUser() != null && mWebsite
!= null) {
                 return rses.isUserAuthorizedToAdmin(mWebsite);
             }
         } catch (Exception e) {



Mime
View raw message