Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 347814 - NullPointerException: Change a mapping to many-to-one or one-to-one mapping
Summary: NullPointerException: Change a mapping to many-to-one or one-to-one mapping
Status: VERIFIED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: General (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.0.1   Edit
Assignee: Karen Butzke CLA
QA Contact:
URL:
Whiteboard: fix_ready
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-31 11:07 EDT by Nan Li CLA
Modified: 2011-08-03 11:48 EDT (History)
2 users (show)

See Also:
neil.hauge: review+


Attachments
Stack Trace (8.61 KB, text/plain)
2011-05-31 11:08 EDT, Nan Li CLA
no flags Details
proposed patch against head (2.03 KB, patch)
2011-06-08 16:02 EDT, Karen Butzke CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nan Li CLA 2011-05-31 11:07:46 EDT
Build Identifier: I20110525-0800

1. Create a mapping file and add a type mapping to it
2. In the JPA structure pane, right-click an attribute and add it to the XML
3. Again right-click the added attribute and try to change the type of it to many-to-one or one-to-one

The following NPE is thrown:


java.lang.NullPointerException
	at java.lang.String.compareTo(Unknown Source)
	at java.lang.String.compareTo(Unknown Source)
	at java.util.Arrays.mergeSort(Unknown Source)
	at java.util.Arrays.sort(Unknown Source)
	at java.util.Collections.sort(Unknown Source)
	at org.eclipse.jpt.common.utility.internal.CollectionTools.sort(CollectionTools.java:1953)

The full stack trace is attached.

Reproducible: Always
Comment 1 Nan Li CLA 2011-05-31 11:08:59 EDT
Created attachment 196988 [details]
Stack Trace
Comment 2 Karen Butzke CLA 2011-06-08 16:02:02 EDT
Created attachment 197639 [details]
proposed patch against head

This patch filters out mapsId choices with a null mapping name. I approached it this way because it is possible to set a mapping name to null in the orm.xml so we would have to prevent this NPE in that case as well.
Comment 3 Karen Butzke CLA 2011-06-24 08:03:11 EDT
checked in to HEAD for 3.0.1
Comment 4 Jolene Moffitt CLA 2011-08-03 11:48:02 EDT
Verified in Build I-3.4.0-20110731180834

Verified you can add an attribute to a mapping file and change it to one-to-one or many-to-one type without error.  see the link to view test steps for verification. http://wiki.eclipse.org/Dali_3.0.1