pgshiping / jforum2

Automatically exported from code.google.com/p/jforum2
Other
0 stars 0 forks source link

When topic cache is disabled, all pages except first and last in a forum display 0 threads #67

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Set topic.cache.enabled to false in SystemGlobals.properties and start JForum
2. Make sure there are enough threads in any forum to span 3 OR MORE pages
3. When viewing the first and last pages (1 & 3), you'll see that they contain 
threads, but all pages in between (i.e. page 2 in my example of 3 pages) 
display 0 threads!

What is the expected output? What do you see instead?
All pages in between the first and last pages should contain threads, but 
they're not visible. They're still being passed to the page, and they still 
exist, but they're just not being displayed.

What version of the product are you using? On what operating system,
database, and application server/servlet container?
* Product: JForum 2.3.6
* OS: Linux
* DB: Postgres
* AP: Tomcat 7

Please provide any additional information below.
So the offending piece of code is this one from TopicsCommon.java, line 120: 

while (size < start) {
    start -= topicsPerPage;
}

Due to this above logic, line 127 line: "return topics.subList(start, (size < 
start + topicsPerPage) ? size : start + topicsPerPage);" seems to always return 
the same index to start and end at for all pages between the first and last, 
meaning no threads are displayed for those pages.

A proposed fix can be to change line 120's logic to: "while (size <= start) {", 
however you can obviously have a look yourself in case there's a better fix 
(this fix may have repercussions, I haven't tested them yet).

P.S. I'm passing this on from a dev in my team who fixed this after I found the 
issue when disabling the cache in testing.

Original issue reported on code.google.com by Pughy12...@gmail.com on 18 May 2015 at 10:31

GoogleCodeExporter commented 8 years ago
Thank you for reporting this issue.

Original comment by andow...@gmail.com on 6 Jul 2015 at 5:41

GoogleCodeExporter commented 8 years ago
Fixed in r494

Original comment by andow...@gmail.com on 8 Jul 2015 at 5:30