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: NUCRDBMS-509
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: FireSign
Votes: 0
Watchers: 1
Operations

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 jpa-list-add.zip (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:
@Entity
public class Product {
...
@OneToMany(cascade = CascadeType.ALL, fetch=FetchType.EAGER)
@JoinTable
private List<ProductProperty> properties;
...
}

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



FireSign added a comment - 20/Mar/11 09:28 AM
Attaching the exception and the test code.

FireSign made changes - 20/Mar/11 09:28 AM
Field Original Value New Value
Attachment npe.txt [ 11392 ]
Attachment jpa-list-add.zip [ 11393 ]
Andy Jefferson made changes - 20/Mar/11 10:54 AM
Comment [ its more normal when you get an exception to actually quote it (and stack trace). ]
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 made changes - 21/Mar/11 09:05 AM
Project DataNucleus API JPA [ 10171 ] DataNucleus Store RDBMS [ 10144 ]
Key NUCJPA-119 NUCRDBMS-509
Affects Version/s 2.1.7 [ 11169 ]
Component/s Persistence [ 10181 ]
Andy Jefferson made changes - 21/Mar/11 09:05 AM
Summary List.add(int index, E element) throws NPE List.add(int index, E element) throws NPE when using ordered list
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

Andy Jefferson made changes - 21/Mar/11 09:06 AM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.0.0.m3 [ 11191 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 01/Apr/11 03:26 PM
Status Resolved [ 5 ] Closed [ 6 ]