| Summary: | Deleting an object from a resource by index | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | Szabolcs Bardy <szbardy> | ||||||
| Component: | cdo.core | Assignee: | Eike Stepper <stepper> | ||||||
| Status: | CLOSED FIXED | QA Contact: | Eike Stepper <stepper> | ||||||
| Severity: | normal | ||||||||
| Priority: | P3 | ||||||||
| Version: | 4.2 | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows 7 | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Created attachment 197104 [details]
Test case to reproduce the error
Created attachment 197107 [details]
Proposed patch
It is a proposed patch that fixes this problem, however I don't know whether it may have other impacts.
Moving all open problem reports to 4.0 Moving all open bug reports to 4.1 because the release is very near and it's hghly unlikely that there will be spare time to address 4.0 problems. Please make sure that your patches can be applied against the master branch and that your problem is not already fixed there!!! Moving all open issues to 4.2. Open bugs can be ported to 4.1 maintenance after they've been fixed in master. Good catch! And sorry that it took so long to get at this. commit 2bc303523081db3ffc96a0e7531f2593bdf904d3 Depending on transaction.options().setStaleReferencePolicy(...) the convertToEMF() call can throw an ObjectNotFoundException (as in Bugzilla_279982_Test). The trick is:
oldValue = revision.get(feature, index);
try
{
oldValue = convertToEMF(eObject, revision, feature, index, oldValue);
}
finally
{
revision.remove(feature, index);
}
return oldValue;
commit e1fd2d34d3033db38bfc1dabd740681bfa296a1a Available in R20130613-1157 (4.2) |
Build Identifier: When removing an object from a CDOResource contents list by its index - CDOResource.getContents().remove(i) - , if the object to remove has not been resolved yet and it is a CDOElementProxy, an IndexOutOfBoundException is thrown. The cause of the problem seems to be in the CDOStoreImpl.remove() method, where the element is removed at first from the contents list oldValue = revision.remove(feature, index); an afterwards it is tried to be resolved: return convertToEMF(eObject, revision, feature, index, oldValue); Reproducible: Always