Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 319950 - ConvertToEMF doesn't work properly with many-valued EDataTypes
Summary: ConvertToEMF doesn't work properly with many-valued EDataTypes
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.0   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Eike Stepper CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2010-07-15 03:30 EDT by Heiko Techteam CLA
Modified: 2011-06-23 03:41 EDT (History)
1 user (show)

See Also:


Attachments
fix it, if values are in list (1.89 KB, patch)
2010-07-15 14:41 EDT, Heiko Ahlig CLA
stepper: iplog+
Details | Diff
Modified Attriubute test (2.21 KB, text/plain)
2010-07-16 19:05 EDT, Heiko Ahlig CLA
stepper: iplog+
Details
Test v3 (1.57 KB, patch)
2010-07-26 02:40 EDT, Eike Stepper CLA
no flags Details | Diff
Test+Fix - for future reference (2.72 KB, patch)
2010-07-26 02:57 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 Heiko Techteam CLA 2010-07-15 03:30:24 EDT
Build Identifier: 

The converter method of the custom CDOType get a ClassCastException, if you have defined your own datatype, and in your model you have a List of of values from this type.
While exporting data from CDO, it trys to convert data back to emf.
The method gets the EDataType and as value a CDOListImpl.
The CDOList could not be casted to String.

Reproducible: Always

Steps to Reproduce:
1. Define your own datatype (I get it with a dataytype from instance type BigDecimal)
2. Define in a model class a attribute with upper Bound > 1
3. Take a model instance into the CDO-Store
4. Try Export the data
Comment 1 Heiko Ahlig CLA 2010-07-15 14:40:14 EDT
Attached Patch should fix the problem if the custom values are in a CDOList.
Comment 2 Heiko Ahlig CLA 2010-07-15 14:41:15 EDT
Created attachment 174433 [details]
fix it, if values are in list
Comment 3 Eike Stepper CLA 2010-07-16 04:01:02 EDT
Comment on attachment 174433 [details]
fix it, if values are in list

Heiko, please confirm that:

1) The number of lines that you changed is smaller than 250.
2) You are the only author of these changed lines.
3) You apply the EPL to these changed lines.
Comment 4 Eike Stepper CLA 2010-07-16 04:27:55 EDT
I added test case org.eclipse.emf.cdo.tests.AttributeTest.testManyValuedCustomDataType_Bugzilla_319950() and it does not fail.

Heiko, please look at it and try to explain why it does not fail. Or better, provide a test case that reproduces your exact problem, then reopen this bug.
Comment 5 Eike Stepper CLA 2010-07-16 04:28:39 EDT
Problem is not reproducible.
Comment 6 Eike Stepper CLA 2010-07-16 04:31:47 EDT
Comment on attachment 174433 [details]
fix it, if values are in list

CDOType is not concerned with the many-valued aspect of features. I think if a list arrives in a CDOType method this should be fixed elsewhere. I'm also not sure if replacing a CDOListImpl with a BasicEList is a good idea.
Comment 7 Heiko Ahlig CLA 2010-07-16 19:05:14 EDT
Created attachment 174546 [details]
Modified Attriubute test

Hi Eike, 
I have seen your Test and hav it modified so the he reproduced the error.

I found this error, when I tried to use the 
org.eclipse.emf.cdo.internal.ui.actions.ExportResourceAction 

From there I also copied the function to reproduce.
In the first patch I use the BasicEList, because it should export to a file.


Where are the point to reopen the bug?
Comment 8 Eike Stepper CLA 2010-07-26 02:38:50 EDT
These two lines are able to show the problem:

    EList<EObject> contents = resource.getContents();
    EcoreUtil.copyAll(contents);
Comment 9 Eike Stepper CLA 2010-07-26 02:40:33 EDT
Created attachment 175196 [details]
Test v3
Comment 10 Eike Stepper CLA 2010-07-26 02:57:26 EDT
Created attachment 175197 [details]
Test+Fix - for future reference

The problem was in CDOStore.isSet() where the many-valued feature was accessed with get(feature, NO_INDEX).

NO_INDEX must only be used with single-valued features.
Comment 11 Eike Stepper CLA 2010-07-26 02:57:58 EDT
Committed to HEAD
Comment 12 Eike Stepper CLA 2010-09-23 04:07:26 EDT
Heiko, please confirm that:

1) The number of lines that you changed is smaller than 250.
2) You are the only author of these changed lines.
3) You apply the EPL to these changed lines.

Otherwise we get into trouble with the legal department ;-(
Comment 13 Heiko Techteam CLA 2010-09-23 05:45:51 EDT
I confirm that:
1) The number of lines that I changed is smaller than 250.
2) I'm the only author of these changed lines.
3) I apply the EPL to these changed lines.
Comment 14 Eike Stepper CLA 2010-09-23 06:05:25 EDT
Comment on attachment 174546 [details]
Modified Attriubute test

Thx ;-)
Comment 15 Eike Stepper CLA 2011-06-23 03:41:38 EDT
Available in R20110608-1407