[jboss-svn-commits] JBL Code SVN: r8810 - in labs/jbossforums/branches/forums22/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:42:15 EST 2007
Author: unibrew
Date: 2007-01-10 18:42:11 -0500 (Wed, 10 Jan 2007)
New Revision: 8810
Modified:
labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java
labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/action/NewTopic.java
labs/jbossforums/branches/forums22/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/branches/forums22/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java
===================================================================
--- labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java 2007-01-10 23:37:44 UTC (rev 8809)
+++ labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java 2007-01-10 23:42:11 UTC (rev 8810)
@@ -1163,6 +1163,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/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/action/NewTopic.java
===================================================================
--- labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/action/NewTopic.java 2007-01-10 23:37:44 UTC (rev 8809)
+++ labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/action/NewTopic.java 2007-01-10 23:42:11 UTC (rev 8810)
@@ -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/branches/forums22/forums/src/resources/portal-forums-war/views/category/viewcategory_body.xhtml
===================================================================
--- labs/jbossforums/branches/forums22/forums/src/resources/portal-forums-war/views/category/viewcategory_body.xhtml 2007-01-10 23:37:44 UTC (rev 8809)
+++ labs/jbossforums/branches/forums22/forums/src/resources/portal-forums-war/views/category/viewcategory_body.xhtml 2007-01-10 23:42:11 UTC (rev 8810)
@@ -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