roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r367184 - in /incubator/roller/trunk/src/org/roller: presentation/velocity/PageModel.java util/Utilities.java
Date Mon, 09 Jan 2006 03:59:51 GMT
Author: snoopdave
Date: Sun Jan  8 19:59:48 2006
New Revision: 367184

URL: http://svn.apache.org/viewcvs?rev=367184&view=rev
Log:
NPE checks from Matt Schmidt

Modified:
    incubator/roller/trunk/src/org/roller/presentation/velocity/PageModel.java
    incubator/roller/trunk/src/org/roller/util/Utilities.java

Modified: incubator/roller/trunk/src/org/roller/presentation/velocity/PageModel.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/velocity/PageModel.java?rev=367184&r1=367183&r2=367184&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/velocity/PageModel.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/velocity/PageModel.java Sun Jan  8
19:59:48 2006
@@ -115,16 +115,18 @@
     
     /** Encapsulates folder.getBookmarks() & sorting */
     public Collection getBookmarks(FolderDataWrapper folder) {
-        mLogger.debug("Getting bookmarks for folder : "+folder.getName());
-        
-        // since we already have a wrapped pojo we know the output
-        // will be wrapped as well :)
-        Collection bookmarks = folder.getBookmarks();
-        
-        // TODO: need to setup new BookmarkWrapperComparator
-        //List mBookmarks = new ArrayList(bookmarks);
-        //Collections.sort( mBookmarks, new BookmarkComparator() );
-        
+        Collection bookmarks = null;
+        if (folder != null) {
+            mLogger.debug("Getting bookmarks for folder : "+folder.getName());
+
+            // since we already have a wrapped pojo we know the output
+            // will be wrapped as well :)
+            bookmarks = folder.getBookmarks();
+
+            // TODO: need to setup new BookmarkWrapperComparator
+            //List mBookmarks = new ArrayList(bookmarks);
+            //Collections.sort( mBookmarks, new BookmarkComparator() );
+        }
         return bookmarks;
     }
     
@@ -742,9 +744,13 @@
     }
     
     public boolean getEmailComments() {
-        WebsiteData website = mRollerReq.getWebsite();
-        boolean emailComments = RollerRuntimeConfig.getBooleanProperty("users.comments.emailnotify");
-        
-        return (website.getEmailComments().booleanValue() && emailComments);
+        if (mRollerReq != null) {
+            WebsiteData website = mRollerReq.getWebsite();
+            if (website != null) {
+                boolean emailComments = RollerRuntimeConfig.getBooleanProperty("users.comments.emailnotify");
       
+                return (website.getEmailComments().booleanValue() && emailComments);
+            }
+        }
+        return false;
     }
 }

Modified: incubator/roller/trunk/src/org/roller/util/Utilities.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/util/Utilities.java?rev=367184&r1=367183&r2=367184&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/util/Utilities.java (original)
+++ incubator/roller/trunk/src/org/roller/util/Utilities.java Sun Jan  8 19:59:48 2006
@@ -1057,17 +1057,20 @@
         }
     }
     
-    public static final String encode(String s) 
+    public static final String encode(String s)
     {
-        try 
-        {
-            return URLEncoder.encode(s, "utf-8");
-        } 
-        catch (UnsupportedEncodingException e) 
-        {
-            return s;
-        }
-    }
+       try
+       {
+           if (s != null)
+               return URLEncoder.encode(s, "utf-8");
+           else
+               return s;
+       }
+       catch (UnsupportedEncodingException e)
+       {
+           return s;
+       }
+   }
 
     /**
      * @param string



Mime
View raw message