java.lang.NullPointerException while running JQL with fixVersion
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Symptoms
java.lang.NullPointerException appears when running a JQL query like : fixVersion >= "2.2.0_00"
The following query returns one or more rows:
1 2 3 4 5
select pv.id from projectversion pv left join project p on pv.project = p.id where p.id is null
The following appears in the atlassian-jira.log
:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2011-08-05 17:38:10,941 http-8080-2 ERROR [500ErrorPage.jsp] Exception caught in 500 page null
java.lang.NullPointerException
at com.atlassian.jira.jql.util.JqlVersionPredicate$1.evaluate(JqlVersionPredicate.java:23)
at com.atlassian.jira.jql.util.JqlVersionPredicate$1.evaluate(JqlVersionPredicate.java:20)
at com.atlassian.jira.util.EvaluateAllPredicate.evaluate(EvaluateAllPredicate.java:27)2011-08-05 17:38:10,941 http-8080-2 ERROR [500ErrorPage.jsp] Exception caught in 500 page null
java.lang.NullPointerException
at com.atlassian.jira.jql.util.JqlVersionPredicate$1.evaluate(JqlVersionPredicate.java:23)
at com.atlassian.jira.jql.util.JqlVersionPredicate$1.evaluate(JqlVersionPredicate.java:20)
at com.atlassian.jira.util.EvaluateAllPredicate.evaluate(EvaluateAllPredicate.java:27)
at com.atlassian.jira.util.collect.CollectionUtil$GCollectPredicate.apply(CollectionUtil.java:475)
at com.google.common.collect.Iterators$7.computeNext(Iterators.java:603)
at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:135)
at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:130)
at com.atlassian.jira.jql.query.RelationalOperatorIdIndexValueQueryFactory.generateRangeQueryForPredicate(RelationalOperatorIdIndexValueQueryFactory.java:130)
at com.atlassian.jira.util.collect.CollectionUtil$GCollectPredicate.apply(CollectionUtil.java:475)
at com.google.common.collect.Iterators$7.computeNext(Iterators.java:603)
at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:135)
at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:130)
at com.atlassian.jira.jql.query.RelationalOperatorIdIndexValueQueryFactory.generateRangeQueryForPredicate(RelationalOperatorIdIndexValueQueryFactory.java:130)
Cause
There is inconsistency in database with respect to fixVersion. There are one or more versions that are not attached to any project. The reason for this could be the result of direct database operations done previously.
Resolution
Run the following query in the database to remove the inconsistency :
1 2 3 4 5
delete from projectversion pro where pro.id in (select pv.id from projectversion pv left join project p on pv.project = p.id where p.id is null);
Restart JIRA.
Re-index JIRA.
Was this helpful?