Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 312096 - Index out of bounds exception possible adding attributes to an orm.xml file
Summary: Index out of bounds exception possible adding attributes to an orm.xml file
Status: VERIFIED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: General (show other bugs)
Version: 2.3   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 2.3 RC1   Edit
Assignee: Karen Butzke CLA
QA Contact:
URL:
Whiteboard: PMC_approved
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-07 12:09 EDT by Karen Butzke CLA
Modified: 2010-05-18 14:13 EDT (History)
3 users (show)

See Also:
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+


Attachments
exception stack trace (3.09 KB, text/plain)
2010-05-07 12:09 EDT, Karen Butzke CLA
no flags Details
proposed patch against head (57.15 KB, patch)
2010-05-10 14:32 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 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