|Re: [CDO/OCL] Bug in error handling causes misleading LegacyModeNotEnabledException [message #915932 is a reply to message #915862]
||Tue, 18 September 2012 08:36
| Ed Willink
Registered: July 2009
This seems remarkably adjacent to existing issues.
From an OCL perspective it is not clear that the OclInvalid result is
not a 'valid' result that should propagate back to the caller. Certainly
invalid is a defined OCL result.
This issue may have further ramifications if/when OCL acquires a
constructor syntax that supports object creation; such objects would
also not be in the model.
And on further reflection an OCL query involving Collection.product may
return a Tuple which is also an object that is not in the model.
So I think the problem is to do with passing OCL returns back to the
caller rather than with the OCL returns themselves.
On 18/09/2012 06:18, Eike Stepper wrote:
> Am 17.09.2012 18:58, schrieb Warwick Burrows:
>> Hi CDO team,
>> I ran into a problem where my previously working model was getting a
>> "Legacy mode is not enabled" message like the following:
>> Caused by: org.eclipse.emf.cdo.util.LegacyModeNotEnabledException:
>> Legacy mode is not enabled
>> at org.eclipse.emf.spi.cdo.FSMUtil.adapt(FSMUtil.java:101)
>> ... 7 more
>> I found that the problem was not due to problems with my objects but
>> due to the mishandling of an error object coming back from an OCL
>> call which was being passed on for further processing as a model
>> object. Here is the code I believe to be in error:
>> Object result = evaluate(query, object);
>> if (result instanceof Collection<?>)
>> for (Object element : (Collection<?>)result)
>> if (!addResult(element, context, view))
>> addResult(result, context, view);
>> The result coming back from evaluate() is an OclInvalid object --
>> signifying that the evaluation failed -- and since the object isn't
>> an instance of a collection it is passed to the addResult() method.
>> FSMUtil then tries to adapt the object in order to get its revision
>> history which fails with the LegacyModeNotEnabled exception since
>> OclInvalid isnt in the model. Ideally the code should be checking for
>> any of the OclStandardLibrary error objects and returning the error
>> information to the caller.
>> Should I open a bugzilla defect for this?
> Strange that this didn't pop up earlier. Yes, please submit a bugzilla
> against EMF/cdo.core.
Powered by FUDForum
. Page generated in 0.07039 seconds