Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Exceptions swallowed during evaluation
Exceptions swallowed during evaluation [message #631670] Fri, 08 October 2010 08:23 Go to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5446
Registered: July 2009
Senior Member
Hi,

I'm having hard times to debug some OCL expressions in combination of a custom lazy extent map. Most exceptions are neither propagated nor logged in AbstractEvaluationVisitor:

public Object visitExpression(OCLExpression<C> expression) {
try {
return expression.accept(getVisitor());
} catch (EvaluationHaltedException e) {
// evaluation stopped on demand, propagate further
throw e;
} catch (RuntimeException e) {
String msg = e.getLocalizedMessage();
if (msg == null) {
msg = OCLMessages.no_message;
}
OCLPlugin.log(Diagnostic.ERROR, OCLStatusCodes.IGNORED_EXCEPTION_WARNING,
OCLMessages.bind(OCLMessages.EvaluationFailed_ERROR_, msg), e);

// failure to evaluate results in invalid
return getInvalid();
}
}

Note that OCLStatusCodes.IGNORED_EXCEPTION_WARNING even suppresses log output about the exception.

Shouldn't the exception be stored somewhere? E.g. in the result, the visitor, the evaluation environment or where ever. Just somewhere that I can access it after the evaluation has failed.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: Exceptions swallowed during evaluation [message #631731 is a reply to message #631670] Fri, 08 October 2010 10:35 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 3844
Registered: July 2009
Senior Member
Hi Eike

> Shouldn't the exception be stored somewhere? E.g. in the result, the
> visitor, the evaluation environment or where ever. Just somewhere that I
> can access it after the evaluation has failed.

Yes. I've thought about this occasionally, but it's not that high on a
much too long list of problems. Please raise a Bugzilla, so that I can't
forget or dismiss it as one of my own ramblings.

It's not that easy:

a) OCL defines that there is exactly one invalid.
b) OCL definjes that a bad evaluation is invalid.
c) if an expression does ...oclIsInvalid() then invalid wasn't a problem.
d) EMF throws a variety of RuntimeExceptions

I'm inclined to ignore a) since the uniqueness of invalid isn't sensibly
observable, so an invalid-with-context should be feasible.

Regards

Ed Willink
Re: Exceptions swallowed during evaluation [message #631846 is a reply to message #631731] Sat, 09 October 2010 00:41 Go to previous message
Eike Stepper is currently offline Eike Stepper
Messages: 5446
Registered: July 2009
Senior Member
Am 08.10.2010 16:35, schrieb Ed Willink:
> Hi Eike
>
>> Shouldn't the exception be stored somewhere? E.g. in the result, the
>> visitor, the evaluation environment or where ever. Just somewhere that I
>> can access it after the evaluation has failed.
>
> Yes. I've thought about this occasionally, but it's not that high on a much too long list of problems. Please raise a Bugzilla, so that I can't forget or dismiss it as one of my own ramblings.
>
> It's not that easy:
>
> a) OCL defines that there is exactly one invalid.
> b) OCL definjes that a bad evaluation is invalid.
> c) if an expression does ...oclIsInvalid() then invalid wasn't a problem.
> d) EMF throws a variety of RuntimeExceptions
>
> I'm inclined to ignore a) since the uniqueness of invalid isn't sensibly observable, so an invalid-with-context should be feasible.
That'd be my favorite, too ;-)

I've filed https://bugs.eclipse.org/bugs/show_bug.cgi?id=327377 , Preserve exceptions thrown from evaluation

Thank you and

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Previous Topic:Complex Model Relationships
Next Topic:[OCL-Java] java.lang.NoClassDefFoundError: lpg/runtime/RuleAction
Goto Forum:
  


Current Time: Sat Apr 19 02:55:24 EDT 2014

Powered by FUDForum. Page generated in 0.01852 seconds