| Summary: | Legacy Mode : "Duplicate ID" Exceptions caused by multiple registrations of the same Object | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | Alex Lagarde <alex.lagarde> | ||||||||||||||
| Component: | cdo.legacy | Assignee: | Martin Fluegge <martin.fluegge> | ||||||||||||||
| Status: | CLOSED FIXED | QA Contact: | Eike Stepper <stepper> | ||||||||||||||
| Severity: | normal | ||||||||||||||||
| Priority: | P3 | CC: | martin.fluegge | ||||||||||||||
| Version: | 4.0 | Flags: | stepper:
review+
|
||||||||||||||
| Target Milestone: | --- | ||||||||||||||||
| Hardware: | All | ||||||||||||||||
| OS: | All | ||||||||||||||||
| Whiteboard: | |||||||||||||||||
| Attachments: |
|
||||||||||||||||
|
Description
Alex Lagarde
Created attachment 182789 [details]
JUnit test for Duplicate ID Exceptions
Created attachment 182790 [details]
Models use for testCase
Created attachment 183985 [details]
Patch v1
Created attachment 183986 [details]
Test v1
Although the fix was quite easy it took a while to figure out what caused the problem. In the end it turned out that the Color<->Graph reference which is unsettable cause the trouble because the legacy wrapper internally called store.isset() while the wrapper is not yet registered in the view. This lead to the creation of a second object.
Alex, thanks for detecting this bug.
I enhanced to CDOView to detect such errors and fixed the bug. I Also attached a test to verify the issue.
Martin, the test (without the fix patch) does *not* fail here... Created attachment 183991 [details]
Test v2
I've commented out two lines of code that seem redundant. The test does still not fail...
In AbstractCDOView there is this line:
OM.LOG.warn("Legacy object has been registered multiple times: " + object);
Why can this happen? Is it bad? How bad? Do we need to bother the user? Or should we better use the TRACER?
Created attachment 183992 [details]
Fix v2
Oh Lord, so many questions ;) >Martin, the test (without the fix patch) does *not* fail here... Yes. That is correct. Sorry that I made the patches a bit confusing. The error occurs if an object is created twice. This does not always lead to the behavior Alex described but both problems have the same root (see below). That's why I introduced the new exception call to detect the problem. Unfortunately the fix and the exception is in the same patch. If you remove the changes from the LegacyWrapper the exception will occur. >OM.LOG.warn("Legacy object has been registered multiple times: " + object); >Why can this happen? I think while an object is created in the AbstractView (701) the whole legacy mechanism starts. This can lead to other calls of the method when the references are resolved. Which can lead to a multiple registration of the same object. >Is it bad? It is not nice. But with the new check now problem. It is only bad having two objects for the same element. >Do we need to bother the user? We could remove this, because the new check detected the real problem. >Or should we better use the TRACER? Good idea. This leaves the message if this could be the root for another problem. Commited to HEAD. Available in R20110608-1407 |