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: Major Major
Assignee: Andy Jefferson
Reporter: Victor Ott
Votes: 0
Watchers: 0

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

NPE when storing "null" value of jodatime types

Created: 31/Mar/10 04:17 AM   Updated: 13/Apr/10 03:32 PM   Resolved: 31/Mar/10 06:21 AM
Component/s: None
Affects Version/s: 2.0.2
Fix Version/s: 2.1.0.m1

File Attachments: 1. Text File JodaDateTimeMapping_npe_in_setobject.patch (0.7 kB)

Environment: JDK 6u18, DataNucleus 2.0.2

Datastore: PostgreSQL
Severity: Production

 Description  « Hide
NPE occurs in method setObject() line 112 when parameter "value" is null.

The other mapping classes, JodaDurationMapping, etc, seem all to have same issue.

Suggested fix: add "return" statement in first if() block, here the patch content:

Index: rdst/src/main/java/org/datanucleus/store/mapped/mapping/
--- rdst/src/main/java/org/datanucleus/store/mapped/mapping/ Wed Mar 31 05:08:20 CEST 2010
+++ rdst/src/main/java/org/datanucleus/store/mapped/mapping/ Wed Mar 31 05:08:20 CEST 2010
@@ -93,6 +93,7 @@
         if (value == null)
             getDatastoreMapping(0).setObject(preparedStatement, exprIndex[0], null);
+ return;
         if (datastoreMappings != null && datastoreMappings.length > 0 && datastoreMappings[0].isStringBased())

Sort Order: Ascending order - Click to sort in descending order
Victor Ott added a comment - 31/Mar/10 04:20 AM
Patch file for suggested fix.

Andy Jefferson added a comment - 31/Mar/10 06:21 AM
SVN trunk has this.
SVN branches/2.0 doesn't have this