[jboss-svn-commits] JBL Code SVN: r8809 - in labs/jbossforums/trunk/forums/src: main/org/jboss/portlet/forums/ui/action and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Jan 10 18:37:49 EST 2007


Author: unibrew
Date: 2007-01-10 18:37:44 -0500 (Wed, 10 Jan 2007)
New Revision: 8809

Modified:
   labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java
   labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/NewTopic.java
   labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/category/viewcategory_body.xhtml
Log:
[JBFORUMS-154] SQL exception is no longer thrown to the log when there are no lastPosts in all forums.

Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java
===================================================================
--- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java	2007-01-10 23:22:31 UTC (rev 8808)
+++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java	2007-01-10 23:37:44 UTC (rev 8809)
@@ -1162,6 +1162,11 @@
                                     String order)
        throws ModuleException
     {
+        
+       if (postIds==null || postIds.size()==0) {
+           return new LinkedList();
+       }
+        
        try
        {
           Session session = getSession();
@@ -1422,6 +1427,12 @@
               dates.add(tmpTopic.getLastPostDate());
               lastPostDates.add(new Object[]{tmpTopic.getLastPostDate(),tmpTopic.getId()});
           }
+          
+          // if there are no createDates then we return an empty map
+          if (dates.size()==0) {
+              return new HashMap(0);
+          }
+          
           Query query = session.createQuery("select post.createDate, post " +
                                       "from PostImpl as post " +
                                       "join fetch post.poster " +
@@ -1475,6 +1486,12 @@
           while(it.hasNext()) {
               dates.add(((Object[])it.next())[0]);
           }
+          
+          // if there are no posts in all forums then return empty map
+          if (dates.size()==0) {
+              return new HashMap(0);
+          }
+          
           query = session.createQuery("select post.createDate, post " +
                                       "from PostImpl as post " +
                                       "join fetch post.poster " +

Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/NewTopic.java
===================================================================
--- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/NewTopic.java	2007-01-10 23:22:31 UTC (rev 8808)
+++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/NewTopic.java	2007-01-10 23:37:44 UTC (rev 8809)
@@ -153,7 +153,7 @@
 	           (List)this.produceAttachments(this.attachments), //attachments
 	           this.topicType
            );
-           BaseController.getForumsModule().createWatch(poster,post.getTopic());
+           
            poster.incrementPostCount();
                       
            //setup the navigation state           

Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/category/viewcategory_body.xhtml
===================================================================
--- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/category/viewcategory_body.xhtml	2007-01-10 23:22:31 UTC (rev 8808)
+++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/category/viewcategory_body.xhtml	2007-01-10 23:37:44 UTC (rev 8809)
@@ -105,13 +105,13 @@
 				        					</h:outputLink>
 				        				</c:otherwise>
 			        				</c:choose>
-                                                                <h:outputLink value="#{forums:postPermlink(category.forumLastPosts[forumrow.id].id)}" style="text-decoration: none;">
-                                                                    <f:verbatim>
-                                                                        <img src="#{forums:themeURL('resourceIconLatestReplyURL')}"
-                                                                             alt='${resource.Posts}'
-                                                                             title='${resource.Posts}' border="0"/>
-                                                                    </f:verbatim>
-                                                                </h:outputLink>
+                                    <h:outputLink value="#{forums:postPermlink(category.forumLastPosts[forumrow.id].id)}" style="text-decoration: none;">
+                                        <f:verbatim>
+                                            <img src="#{forums:themeURL('resourceIconLatestReplyURL')}"
+                                                 alt='${resource.Posts}'
+                                                 title='${resource.Posts}' border="0"/>
+                                        </f:verbatim>
+                                    </h:outputLink>
 		        				</c:when>
 		        				<c:otherwise>
 		        					#{resource.No_Posts}




More information about the jboss-svn-commits mailing list