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: NUCJODATIME-10
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Andy Jefferson
Reporter: Danny van Leiden
Votes: 0
Watchers: 0
Operations

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 JodaDateTimeLiteral.java.patch (0.7 kB)
2. Text File JodaTimeTest.java.patch (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.

Sort Order: Ascending order - Click to sort in descending order
Danny van Leiden added a comment - 15/Jun/12 10:26 AM
Attached patch to check for null value.

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
http://datanucleus.svn.sourceforge.net/viewvc/datanucleus/test/accessplatform/trunk/test.jdo.general/src/test/org/datanucleus/tests/types/JodaTimeTest.java?revision=14854&view=markup

(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.

Andy Jefferson added a comment - 18/Jun/12 11:25 AM
Tests in SVN trunk, thx