Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 308895

Summary: [DB] Saving a default value of a custom type throws NotSerializableException
Product: [Modeling] EMF Reporter: Erwin Betschart <erwin>
Component: cdo.dbAssignee: Stefan Winkler <stefan>
Status: CLOSED FIXED QA Contact: Eike Stepper <stepper>
Severity: normal    
Priority: P3 CC: stefan, stepper
Version: 3.0Flags: stepper: review+
Target Milestone: ---   
Hardware: PC   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=306998
Whiteboard:
Bug Depends on:    
Bug Blocks: 326743    
Attachments:
Description Flags
The thrown exception
none
Proposed fix.
none
Patch-v2 none

Description Erwin Betschart CLA 2010-04-12 13:08:08 EDT
Build Identifier: 3.0.0

See steps to reproduce.





Reproducible: Always

Steps to Reproduce:
1. Define a ecore model having the following constraints:
- A custom type e.g. Color
- A feature for this custom type e.g.: Organisation.getColor()
- The color feature on the organisation must have a default e.g. defaultValueLiteral= 0xff (The serialized form of the custom color type)

2. Commit an organisation object without setting the color.
3. The attached exception (NotSerializableException) is thrown.
Comment 1 Erwin Betschart CLA 2010-04-12 13:08:47 EDT
Created attachment 164590 [details]
The thrown exception
Comment 2 Erwin Betschart CLA 2010-04-12 13:10:31 EDT
Created attachment 164591 [details]
Proposed fix.

Store the literal of the default not the literal itself.
Comment 3 Erwin Betschart CLA 2010-04-12 13:12:54 EDT
Confirmation if needed...

> 1) The number of lines that you changed is smaller than 250.
confirmed
> 2) You are the only author of these changed lines.
confirmed
> 3) You apply the EPL to these changed lines.
confirmed
Comment 4 Stefan Winkler CLA 2010-04-13 01:59:28 EDT
Thanks for your input, Erwin. I'll create a testcase for this as well.
Comment 5 Stefan Winkler CLA 2010-05-08 10:36:18 EDT
Created attachment 167602 [details]
Patch-v2

I added a testcase which reproduces the problem. 
Erwin's fix looks good. Test succeeds with that change.
Comment 6 Stefan Winkler CLA 2010-05-09 08:04:05 EDT
Committed to HEAD.
Comment 7 Eike Stepper CLA 2010-06-29 04:36:11 EDT
Available in 3.0 GA:
http://download.eclipse.org/modeling/emf/cdo/updates/3.0-releases/