|
Re: [CDO/OCL] Bug in error handling causes misleading LegacyModeNotEnabledException [message #915862 is a reply to message #915628] |
Tue, 18 September 2012 05:18 |
|
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)
> at org.eclipse.emf.cdo.server.ocl.OCLQueryHandler.getRevision(OCLQueryHandler.java:204)
> at org.eclipse.emf.cdo.server.ocl.OCLQueryHandler.addResult(OCLQueryHandler.java:195)
> at org.eclipse.emf.cdo.server.ocl.OCLQueryHandler.executeQuery(OCLQueryHandler.java:175)
> ... 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))
> {
> break;
> }
> }
> }
> else
> {
> 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.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
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 Messages: 7670 Registered: July 2009 |
Senior Member |
|
|
Hi Eike
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.
Regards
Ed Willink
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)
>> at
>> org.eclipse.emf.cdo.server.ocl.OCLQueryHandler.getRevision(OCLQueryHandler.java:204)
>> at
>> org.eclipse.emf.cdo.server.ocl.OCLQueryHandler.addResult(OCLQueryHandler.java:195)
>> at
>> org.eclipse.emf.cdo.server.ocl.OCLQueryHandler.executeQuery(OCLQueryHandler.java:175)
>> ... 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))
>> {
>> break;
>> }
>> }
>> }
>> else
>> {
>> 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.
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.24798 seconds