Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 359669 - CDO cannot handle resources with indexed fragments
Summary: CDO cannot handle resources with indexed fragments
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Martin Fluegge CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-02 17:33 EDT by Martin Fluegge CLA
Modified: 2012-09-21 07:16 EDT (History)
0 users

See Also:
stepper: review+


Attachments
Test v1 (1.80 KB, patch)
2011-10-02 17:35 EDT, Martin Fluegge CLA
no flags Details | Diff
Patch v1 (1.24 KB, patch)
2011-10-02 17:44 EDT, Martin Fluegge CLA
no flags Details | Diff
Patch v2 (incl. test) (3.94 KB, patch)
2011-10-05 04:20 EDT, Eike Stepper CLA
no flags Details | Diff
Test v3 (21.71 KB, patch)
2011-10-09 06:25 EDT, Martin Fluegge CLA
no flags Details | Diff
Patch v2 (3.29 KB, patch)
2011-10-09 06:26 EDT, Martin Fluegge CLA
no flags Details | Diff
Patch v3 (combined) (6.14 KB, patch)
2011-10-09 07:45 EDT, Martin Fluegge CLA
no flags Details | Diff
Patch v4 (6.33 KB, patch)
2011-10-10 02:16 EDT, Eike Stepper CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Fluegge CLA 2011-10-02 17:33:27 EDT
The following URL is valid and should deliver the first object in the resource:

cdo://repo1/default1317589160531.acore_graphiti#/0

Likewise should do a call as the following

resource.getEObject("/0");

Actually COD fails on this and delivers null.
Comment 1 Martin Fluegge CLA 2011-10-02 17:35:12 EDT
Created attachment 204429 [details]
Test v1

I attached a test to reproduce the issue.
Comment 2 Martin Fluegge CLA 2011-10-02 17:44:24 EDT
Created attachment 204430 [details]
Patch v1

And here comes the patch...
Comment 3 Eike Stepper CLA 2011-10-05 04:19:57 EDT
According to http://learning.infocollections.com/ebook%202/Computer/Programming/Java/Eclipse.Modeling.Framework/0131425420_ch13lev1sec2.html the URI fragment can be much more complex than the one you're using in the single test case. Will attach a more complex test in a minute...
Comment 4 Eike Stepper CLA 2011-10-05 04:20:23 EDT
Created attachment 204571 [details]
Patch v2 (incl. test)
Comment 5 Martin Fluegge CLA 2011-10-09 06:25:39 EDT
Created attachment 204829 [details]
Test v3

I had some hard time finding the fix, because you had a nice typo in your test. 

it must be 

resource.getEObject("//@categories.0/@products.2");

and not 

resource.getEObject("//@categories.0/@product.2");

The missing 's' made it impossible to finde the correct feature ;)

Attached the corrected version.
Comment 6 Martin Fluegge CLA 2011-10-09 06:26:30 EDT
Created attachment 204830 [details]
Patch v2

Here comes a fixe whcih basically bases on the ResourceImpl implementation.
Comment 7 Eike Stepper CLA 2011-10-09 06:47:46 EDT
(In reply to comment #5)
> I had some hard time finding the fix, because you had a nice typo in your test. 
> it must be 
> 
> resource.getEObject("//@categories.0/@products.2");
> 
> and not 
> 
> resource.getEObject("//@categories.0/@product.2");
> 
> The missing 's' made it impossible to finde the correct feature ;)
> Attached the corrected version.

Oops ;-(
Comment 8 Martin Fluegge CLA 2011-10-09 07:45:20 EDT
Created attachment 204832 [details]
Patch v3 (combined)

Sorry, the last patch contained to much. Applied a combined patch in the correct version.
Comment 9 Eike Stepper CLA 2011-10-10 02:16:20 EDT
Created attachment 204852 [details]
Patch v4

I've removed the comment where you're asking if we should return "this" from getEObject() if uriFragment==null. I think that unnecessarily creates an incompatibility with EMF.
Comment 10 Eike Stepper CLA 2011-10-10 02:18:01 EDT
Please backport to 4.0 via bug 360380.
Comment 11 Martin Fluegge CLA 2011-10-10 13:08:52 EDT
Committed revision 9470
Comment 12 Eike Stepper CLA 2012-09-21 07:16:01 EDT
Closing.