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)

Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Andy Jefferson
Reporter: Danny van Leiden
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
DataNucleus Types : JodaTime

NPE in JodaDateTimeLiteral constructor if parameter 'value' is null.

Created: 15/Jun/12 10:25 AM   Updated: 06/Jul/12 09:39 AM   Resolved: 18/Jun/12 11:25 AM
Component/s: None
Affects Version/s: 3.0.1, 3.1.0.m1, 3.1.0.m2
Fix Version/s: 3.1.0.m3

File Attachments: 1. Text File (0.7 kB)
2. Text File (5 kB)

Environment: OSGi (Equinox)

Datastore: PostgreSQL
Severity: Production

 Description  « Hide
Although several null checks are performed on parameter 'value', date.setTime(((DateTime)value).getMillis()); will still be called if the DateTime is mapped as temporal, resulting in a NullPointerException.

Danny van Leiden added a comment - 15/Jun/12 10:26 AM
Attached patch to check for null value.

Danny van Leiden made changes - 15/Jun/12 10:26 AM
Field Original Value New Value
Attachment [ 11665 ]
Andy Jefferson added a comment - 15/Jun/12 12:08 PM
Thanks for the patch. Please provide a test that demonstrates this, by reference to the existing tests for JodaTime at

(the samples are referenced from there). That way we safeguard future versions.

Danny van Leiden added a comment - 18/Jun/12 10:53 AM
I see you fixed this issue for all JodaTime types in trunk, thanks.
I attached a patch to the JodaTimeTest that tests storing null in all types, like the test you already added for Interval.

Danny van Leiden made changes - 18/Jun/12 10:53 AM
Attachment [ 11667 ]
Andy Jefferson added a comment - 18/Jun/12 11:25 AM
Tests in SVN trunk, thx

Andy Jefferson made changes - 18/Jun/12 11:25 AM
Status Open [ 1 ] Resolved [ 5 ]
Assignee Andy Jefferson [ andy ]
Fix Version/s 3.1.0.m3 [ 11593 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 06/Jul/12 09:39 AM
Status Resolved [ 5 ] Closed [ 6 ]