Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 347814

Summary: NullPointerException: Change a mapping to many-to-one or one-to-one mapping
Product: [WebTools] Dali JPA Tools Reporter: Nan Li <nan.n.li>
Component: GeneralAssignee: Karen Butzke <karenfbutzke>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jolene.moffitt, neil.hauge
Version: unspecifiedFlags: neil.hauge: review+
Target Milestone: 3.0.1   
Hardware: PC   
OS: Windows 7   
Whiteboard: fix_ready
Attachments:
Description Flags
Stack Trace
none
proposed patch against head none

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