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

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(
at java.util.Date.compareTo(
at java.util.Date.compareTo(
at org.datanucleus.query.evaluator.JavaQueryEvaluator$
at java.util.Arrays.mergeSort(
at java.util.Arrays.mergeSort(
at java.util.Arrays.mergeSort(
at java.util.Arrays.sort(
at org.datanucleus.query.evaluator.JavaQueryEvaluator.ordering(
at org.datanucleus.query.evaluator.JavaQueryEvaluator.execute(
at org.datanucleus.api.jdo.JDOQuery.execute(
-- 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?

Sort Order: Ascending order - Click to sort in descending order
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.

Andy Jefferson added a comment - 14/Sep/11 08:54 PM
Can't reproduce anything of this sort on any recent code