NullPointerException on Crucible Review re-index
Symptoms
The following error appears in the logs when attempting a review re-index:
[java] 2012-06-22 17:59:45,611 ERROR - Error indexing review
[java] java.lang.NullPointerException
[java] at com.atlassian.crucible.activity.lucene.DefaultReviewItemIndexer.indexLogItem(DefaultReviewItemIndexer.java:549)
[java] at com.atlassian.crucible.activity.lucene.DefaultReviewItemIndexer.access$600(DefaultReviewItemIndexer.java:86)
[java] at com.atlassian.crucible.activity.lucene.DefaultReviewItemIndexer$IndexOperationIterator.doNext(DefaultReviewItemIndexer.java:243)
[java] at com.atlassian.crucible.activity.lucene.DefaultReviewItemIndexer$2.perform(DefaultReviewItemIndexer.java:357)
[java] at com.atlassian.crucible.activity.lucene.DefaultReviewItemIndexer$2.perform(DefaultReviewItemIndexer.java:353)
[java] at com.cenqua.fisheye.lucene.LuceneConnection.withWriter(LuceneConnection.java:557)
[java] at com.atlassian.crucible.activity.lucene.DefaultReviewItemIndexer.indexInBatches(DefaultReviewItemIndexer.java:353)
[java] at com.atlassian.crucible.activity.lucene.DefaultReviewItemIndexer.access$800(DefaultReviewItemIndexer.java:86)
[java] at com.atlassian.crucible.activity.lucene.DefaultReviewItemIndexer$3.run(DefaultReviewItemIndexer.java:603)
[java] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
[java] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[java] at java.lang.Thread.run(Thread.java:680)
Cause
The CRU_LOGITEM
table contains events for user IDs that do not exist. An earlier version of the scripts that fix this issue with _old1
usernames did not update the CRU_LOGITEM
table.
Workaround
The following SQL query will delete any logitems created by users which do not exist in the user table:
DELETE FROM CRU_LOGITEM WHERE (cru_user_id
NOT IN (SELECT cru_user_id FROM cru_user)) AND
(cru_action IN
('REVIEW_REVIEWER_ADDED_MID_REVIEW', 'REVIEW_REVIEWER_REMOVED_MID_REVIEW'))
Alternatively, this SQL query can be used to update any records in the log item table to point to a dummy user ID:
UPDATE CRU_LOGITEM
SET cru_user_id = [NEW_UID]
WHERE (cru_user_id NOT IN (SELECT cru_user_id FROM cru_user)) AND
(cru_action IN
('REVIEW_REVIEWER_ADDED_MID_REVIEW', 'REVIEW_REVIEWER_REMOVED_MID_REVIEW'))
Resolution
Upgrade to the latest version of Fisheye/Crucible (2.7.15 or 2.8). Later versions contain a fix which will ignore the invalid log entries on re-index.