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: Unassigned
Reporter: FireSign
Votes: 0
Watchers: 1

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

List.add(int index, E element) throws NPE when using ordered list

Created: 20/Mar/11 09:26 AM   Updated: 01/Apr/11 03:26 PM   Resolved: 21/Mar/11 09:06 AM
Component/s: None
Affects Version/s: None
Fix Version/s: 3.0.0.m3

File Attachments: 1. Zip Archive (4 kB)
2. Text File npe.txt (2 kB)

Environment: Windows XP, Java 1.6.0_21-b07

Datastore: HSQL
Severity: Proof of Concept

 Description  « Hide
Call of List.add(int index, E element) causes NullPointerException.

The JPA Entity:
public class Product {
@OneToMany(cascade = CascadeType.ALL, fetch=FetchType.EAGER)
private List<ProductProperty> properties;

Datanucleus version:
datanucleus core: 2.2.3
datanucleus-jpa: 2.1.7
datanucleus enhancer: 2.1.3

Sort Order: Ascending order - Click to sort in descending order
FireSign added a comment - 20/Mar/11 09:28 AM
Attaching the exception and the test code.

Andy Jefferson added a comment - 20/Mar/11 10:59 AM
you cannot insert an element in an ordered list at a position. you have to have an indexed list for that, obviously. the exception needs changing

Andy Jefferson added a comment - 21/Mar/11 09:06 AM
now logs a warning message that the user really ought to understand what is an ordered list