Description
The problem
On a Confluence instance using an external user directory deleted users can cause the mentions feature to log NPEs, and stop sending notifications.
The root cause is that DefaultFollowManager.getFollowers() is missing a null check. It should be checking that follower is not null, similar to the check in the getFollowing() method.
The following NullPointerException is thrown on the logs:
2014-06-13 11:12:26,166 ERROR [http-bio-8552-exec-4] [common.error.jersey.ThrowableExceptionMapper] toResponse Uncaught exception thrown by REST service: null -- referer: http:/localhost:8080/confluence/pages/editpage.action?pageId=917517 | url: /confluence/rest/mentions/1/network.json | userName: admin java.lang.NullPointerException at com.atlassian.confluence.user.persistence.dao.CachingPersonalInformationDao.getByUser(CachingPersonalInformationDao.java:34) ...
Workaround
Manually deleting the old references from the FOLLOW_CONNECTIONS table. This can be done with the following SQL statement:
delete from follow_connections where follower in (select user_key from user_mapping where lower_username not in (select lower_user_name from cwd_user))
Make sure to create a database backup before any modification.
Confluence will need to be restarted after remove those entries from the database.