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-728
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Daniel Baldes
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Core

Detaching SortedSet fails / detach disrespects comparator-name extension

Created: 29/Jun/11 11:00 AM   Updated: 01/Aug/11 10:23 AM   Resolved: 29/Jun/11 12:22 PM
Component/s: None
Affects Version/s: 3.0.0.m5
Fix Version/s: 3.0.0.m6

File Attachments: 1. Text File comparator.patch (1.0 kB)


Forum Thread URL: http://www.datanucleus.org/servlet/forum/viewthread_thread,6752


 Description  « Hide
I got a class "Host", having a SortedSet property "interfaces". In metadata, I have specified the comparator-name extension for "interfaces". When I detach the host, I get the following exception:

java.lang.ClassCastException: xxx.Interface cannot be cast to java.lang.Comparable.

This is caused by org.datanucleus.store.types.sco.simple.SortedSet.detachCopy() instantiating a TreeSet without the defined comparator.

Patch following.

Daniel Baldes added a comment - 29/Jun/11 11:03 AM
Attached a patch against the trunk (currently 3.0.0m6)

Daniel Baldes made changes - 29/Jun/11 11:03 AM
Field Original Value New Value
Attachment comparator.patch [ 11472 ]
Daniel Baldes added a comment - 29/Jun/11 11:06 AM
The patch changes detachCopy() so that it looks up the comparator extension and instantiates the detached TreeSet with that comparator, if defined. It does that in a similar way like the constructor of ...sco.backed.SortedSet.

Andy Jefferson added a comment - 29/Jun/11 12:22 PM
Thx for the patch. Also applies to TreeSet

Andy Jefferson made changes - 29/Jun/11 12:22 PM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.0.0.m6 [ 11266 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 01/Aug/11 10:23 AM
Status Resolved [ 5 ] Closed [ 6 ]