Issue Details (XML | Word | Printable)

Key: NUCCORE-765
Type: Bug Bug
Status: Closed Closed
Resolution: Cannot Reproduce
Priority: Testcase Required Testcase Required
Assignee: Unassigned
Reporter: Joscha Feth
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
DataNucleus Core

Ordering on nullable field throws NullPointerException in JavaQueryEvaluator

Created: 26/Aug/11 05:30 AM   Updated: 03/Oct/11 07:37 AM   Resolved: 14/Sep/11 08:54 PM
Component/s: Queries
Affects Version/s: 3.0.0.release
Fix Version/s: None

Environment: OSX Lion

Datastore: HBase


 Description  « Hide
When ordering on a field which is of type Date but nullable, the query evaluator hits a null pointer exception:

-- 8< --
Caused by: java.lang.NullPointerException
at java.util.Date.getMillisOf(Date.java:939)
at java.util.Date.compareTo(Date.java:959)
at java.util.Date.compareTo(Date.java:112)
at org.datanucleus.query.evaluator.JavaQueryEvaluator$2.compare(JavaQueryEvaluator.java:476)
at java.util.Arrays.mergeSort(Arrays.java:1270)
at java.util.Arrays.mergeSort(Arrays.java:1281)
at java.util.Arrays.mergeSort(Arrays.java:1281)
at java.util.Arrays.sort(Arrays.java:1210)
at org.datanucleus.query.evaluator.JavaQueryEvaluator.ordering(JavaQueryEvaluator.java:458)
at org.datanucleus.query.evaluator.JavaQueryEvaluator.execute(JavaQueryEvaluator.java:221)
at org.datanucleus.store.hbase.query.JDOQLQuery.performExecute(JDOQLQuery.java:272)
at org.datanucleus.store.query.Query.executeQuery(Query.java:1786)
at org.datanucleus.store.query.Query.executeWithArray(Query.java:1662)
at org.datanucleus.store.query.Query.execute(Query.java:1635)
at org.datanucleus.api.jdo.JDOQuery.execute(JDOQuery.java:221)
-- 8< --

The field itself is defined like this:

-- 8< --
@Persistent(name = DATE_STARTED_DB_FIELD, columns = { @Column(name = DATE_STARTED_DB_FIELD, allowsNull = "true") }, cacheable = "true")
private Date dateStarted;
-- 8< --

I could not find any documentation on this, but if sorting on nullable fields is not allowed in general, is there a way to work around this?

Andy Jefferson made changes - 26/Aug/11 08:56 AM
Field Original Value New Value
Project DataNucleus JDO Query [ 10280 ] DataNucleus Core [ 10143 ]
Key NUCJDOQUERY-11 NUCCORE-765
Affects Version/s 3.0.0.release [ 11061 ]
Affects Version/s 3.0.0.release [ 11231 ]
Andy Jefferson added a comment - 26/Aug/11 08:58 AM
So if it throws an exception in that class, it can't be a problem in an "annotation processor" (where it was raised). Any bug requires a valid testcase to reproduce it, as per the docs and JIRA front page.
http://www.datanucleus.org/project/problem_jdo_testcase.html

Andy Jefferson made changes - 26/Aug/11 08:58 AM
Priority Major [ 3 ] Incomplete [ 6 ]
Component/s Queries [ 10154 ]
Andy Jefferson added a comment - 14/Sep/11 08:54 PM
Can't reproduce anything of this sort on any recent code

Andy Jefferson made changes - 14/Sep/11 08:54 PM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Cannot Reproduce [ 5 ]
Andy Jefferson made changes - 03/Oct/11 07:37 AM
Status Resolved [ 5 ] Closed [ 6 ]