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

Bug 312096

Summary: Index out of bounds exception possible adding attributes to an orm.xml file
Product: [WebTools] Dali JPA Tools Reporter: Karen Butzke <karenfbutzke>
Component: GeneralAssignee: Karen Butzke <karenfbutzke>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: kaloyan, neil.hauge, paul.fullbright
Version: 2.3Flags: neil.hauge: pmc_approved? (david_williams)
neil.hauge: pmc_approved? (raghunathan.srinivasan)
neil.hauge: pmc_approved? (naci.dai)
neil.hauge: pmc_approved? (deboer)
neil.hauge: pmc_approved? (neil.hauge)
kaloyan: pmc_approved+
neil.hauge: review+
Target Milestone: 2.3 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard: PMC_approved
Attachments:
Description Flags
exception stack trace
none
proposed patch against head none

Description Karen Butzke CLA 2010-05-07 12:09:49 EDT
Created attachment 167501 [details]
exception stack trace

Given a java file with about 50 attributes in it, add the java entity to an orm.xml file.  Select about 20 virtual attributes in the JPA Structure view, right-click and select 'Add Attribute to XML'.  Sometimes an exception will occur (possibly multiple times), and the structure view will be corrupted with duplicate virtual attributes.
Comment 1 Karen Butzke CLA 2010-05-10 14:32:08 EDT
Created attachment 167777 [details]
proposed patch against head

The only real change in this patch is in GenericOrmPersistentType.updateVirtualAttributes() where I removed the code that attempts to keep virtual attributes in the same order as the java model they are built from.  This was not deterministic code and was causing the index out of bounds exception.  We decided this is unnecessary, especially since it wasn't working anyway.  The rest of the changes are to tests that broke with this change.  I have changed them such that they don't depend on the order of the attributes.
Comment 2 Neil Hauge CLA 2010-05-11 09:53:48 EDT
* Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such. 

Our persistence outline can be corrupted while working with the orm.xml mapping file.

* Is there a work-around? If so, why do you believe the work-around is insufficient? 

Workaround requires closing of the UI, but user would have to realize the corrupted state.

* How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added? 

Manually tested by Karen and me.

* Give a brief technical overview. Who has reviewed this fix? 

See comment 1.  I have reviewed the fix.

* What is the risk associated with this fix? 

Low risk.  Change is isolated, and is very small.  99% of the patch is unit test related.
Comment 3 Karen Butzke CLA 2010-05-11 10:22:38 EDT
checked in for RC1
Comment 4 Paul Fullbright CLA 2010-05-18 14:13:39 EDT
verified could not reproduce bug in RC1