File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JForum and the fly likes Own posts appearing as unread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » JForum
Bookmark "Own posts appearing as unread" Watch "Own posts appearing as unread" New topic

Own posts appearing as unread

Migrated From
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424

I'm seeing the following bug:

When I create a new post it appears as read, when I then shut down my browser (and make sure I clear the session cookie), and log in again my own post appears as unread.

This does not happen when I try the same thing on the JForum installation, so I'm assuming this is happening due to the fact that I'm using SSO.

Reading through the code I see that a message is read if:

- User.getLastVisit is later than the post time
- The message is marked as read in 2 maps on the users session

As far as I can see the maps are cleared everytime a session is created so I suspect the problem is in the getLastVisit time. I can see in the database of my installation that it is never updated, and as far as I can see in code it is only written to the database when UserDAO.update is called, which is only called when a user changes his profile. In the UserAction the last visit time is set on login, but as far as I can see it is not set when a user logs in using SSO.

How is the last visit time supposed to work (if it is not updated after every action I do then my own posts would still appear as unread as they were per defenition posted after I logged in)? What can I do to fix my problem?
[originally posted on by jrouwe]
Migrated From
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Ok, found the bug: UserSession.updateSessionTime() is never called when you have SSO enabled.

The correct code in ControllerUtils should be:

(see comment marked with Jorrit: ...)
[originally posted on by jrouwe]
I agree. Here's the link:
subject: Own posts appearing as unread
It's not a secret anymore!