NullPointerException when accessing review
Symptoms
Unable to access a specific review.
The following appears in the atlassian-fisheye-<date>.log
:
2013-08-13 14:31:28,036 ERROR [btpool0-1072 ] org.mortbay.log Slf4jLog-warn - Nested in javax.servlet.ServletException: javax.el.ELException: java.lang.NullPointerException:
javax.el.ELException: java.lang.NullPointerException
at javax.el.BeanELResolver.getValue(BeanELResolver.java:298)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:175)
at com.sun.el.parser.AstValue.getValue(AstValue.java:138)
...
Caused by: java.lang.NullPointerException
at com.cenqua.crucible.view.ReviewParticipantDO.<init>(ReviewParticipantDO.java:22)
at com.cenqua.crucible.view.ReviewDO.getAuthorPDO(ReviewDO.java:224)
at sun.reflect.GeneratedMethodAccessor1232.invoke(Unknown Source)
Diagnosis
Run the following SQL query:
SELECT * FROM cru_review_participant WHERE cru_review_id = (SELECT cru_review_id FROM cru_revpermaid WHERE cru_proj_key='<project_key>' AND cru_number=<review_number>);
Substitute the <project_key> and <review_number> with the review key e.g.: CR-123 (<project_key>-<review_number>)
If the result does not have any user with cru_author=1
, then the problem will happen.
Cause
The review does not have any author assigned to it. Crucible will hit into NullPointerException when searching for the review's author.
Resolution
- Backup database for rollback purposes
Run the following SQL query to update an user to be the author of the review
UPDATE cru_review_participant SET cru_author=1 WHERE cru_participant_id=<id_from_diagnosis>; --For PostgreSQL: UPDATE cru_review_participant SET cru_author='true' WHERE cru_participant_id=<id_from_diagnosis>;
Substitute
<id_from_diagnosis>
with one of thecru_participant_id
found at Diagnosis sectionWhen setting cru_author=1, make sure that the user in table is not also a reviewer (cru_reviewer=1 or true), as a user cannot be both owner and reviewer for a specific review. If they are:
UPDATE cru_review_participant SET cru_reviewer=0 WHERE cru_participant_id=<id_from_diagnosis>;
- Restart the server