Issue Details (XML | Word | Printable)

Key: NUCJODATIME-9
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
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

JodaIntervalMapping null check unreachable when storing interval in two timestamp columns

Created: 06/Jun/12 10:03 AM   Updated: 06/Jun/12 12:28 PM   Resolved: 06/Jun/12 12:25 PM
Component/s: None
Affects Version/s: 3.0.1, 3.1.0.m1
Fix Version/s: 3.1.0.m2

File Attachments: 1. Text File JodaIntervalMapping.java.patch (2 kB)


Datastore: PostgreSQL
Severity: Production


 Description  « Hide
When persisting an object with an Interval field stored in two timestamp columns, if the field contains a null value, only the first column is set to null.
This results in a failure to execute the SQL insert query, due to a missing parameter.

In my case, this results in the following exception:
org.postgresql.util.PSQLException: No value specified for parameter 16.

I've traced this back to org.datanucleus.store.mapped.mapping.JodaIntervalMapping#setObject:
A null check is performed on the 'value' parameter, making the later null check on the 'interval' variable unreachable.
This results in only one 'null' object to be added to the datastore mapping, instead of two.

Danny van Leiden added a comment - 06/Jun/12 10:04 AM
Patch for trunk attached.

Danny van Leiden made changes - 06/Jun/12 10:04 AM
Field Original Value New Value
Attachment JodaIntervalMapping.java.patch [ 11662 ]
Andy Jefferson added a comment - 06/Jun/12 12:25 PM
In SVN trunk, along with a test. Thx

Andy Jefferson made changes - 06/Jun/12 12:25 PM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.1.0.m2 [ 11591 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 06/Jun/12 12:28 PM
Status Resolved [ 5 ] Closed [ 6 ]