DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
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?

Andy Jefferson made changes - 26/Aug/11 08:56 AM
Field Original Value New Value
Project DataNucleus JDO Query [ 10280 ] DataNucleus Core [ 10143 ]
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.

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 ]