Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » How to handle validation problems?
How to handle validation problems? [message #1108300] Fri, 13 September 2013 16:54 Go to next message
Maarten Bezemer is currently offline Maarten Bezemer
Messages: 117
Registered: February 2012
Senior Member
Hello,

Sometimes I am getting a ridiculous amount of validation exceptions (shown in the same amount of dialogs, making my system quite unresponsive).
So I thought it is time to prevent this (e.g. by ignoring validation problems after 10 are found).
With the current EvlValidator class this is not really possible.

The EvlValidator.validate(Resource, Map<Object, Object>) catches exception and show them in a log + dialog.
I have some thoughts about this:

  1. When an exception is caught, the validation should be canceled... Now it continues, which is not likely the perform the validation correctly.
  2. The method does not provide means to let the callee know whether an exception occurred... E.g. via a return value or a rethrown exception

My opinion is to cancel the validation when an exception occurs (point 1) and throw a new exception telling what went wrong (point 2), instead of directly logging them.
The newly thrown exception can be caught in the validate(EClass, EObject, DiagnosticChain, Map<Object, Object>) method and added to the log, to keep the default behavior.

But now a custom validator is able to handle them as desired. E.g. keeping a counter and stop showing the exceptions after a certain threshold is reached.

Any additional thoughts about this subject?

Again, I am willing to provide a patch when a consensus is achieved.

Have a good weekend!
Cheers,
Maarten
Re: How to handle validation problems? [message #1108823 is a reply to message #1108300] Sat, 14 September 2013 12:24 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 880
Registered: July 2009
Senior Member
Hi Maarten,

Does the attached patch do the trick? Briefly, it terminates the validation process in case of parse problems/exceptions, it introduces a showErrorDialog flag to configure whether the dialog should pop up or not, and adds support for attaching ValidationProblemListeners to an EvlValidator so that clients can be notified when problems are encountered.

Cheers,
Dimitris
Re: How to handle validation problems? [message #1110755 is a reply to message #1108823] Tue, 17 September 2013 09:41 Go to previous messageGo to next message
Maarten Bezemer is currently offline Maarten Bezemer
Messages: 117
Registered: February 2012
Senior Member
Hi Dimitris,

I tried your patch and it almost helps me.
The only problem is that I still gets thousands and thousands of log entries, which still cripple my application...
If the log is also omitted when isShowErrorDialog() returns false, it solves my problem.

By default, it will never return false, so this additional change should also not influence the current behaviour.


Another thing:
While I was trying your patch, I wanted to use LogUtil in my Custom EvlValidator and noticed that it is located in a 'dt-package'.
I do not add dependencies on these packages/plugins so I could not use LogUtil...
Could this class get moved outside this package?

Thanks,
Maarten
Re: How to handle validation problems? [message #1111212 is a reply to message #1110755] Wed, 18 September 2013 00:09 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 880
Registered: July 2009
Senior Member
Hi Maarten,

I've added a logErrors field to EvlValidator which should allow you to disable error logging [1] and released a new interim version that includes the fix.

Regarding LogUtil, we'll need to think about where we should move it a bit more (we'll probably need to split the common.dt plugin and introduce a new feature). Please feel free to file an enhancement request so that we can keep track of this.

Cheers,
Dimitris

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=417464
Re: How to handle validation problems? [message #1111445 is a reply to message #1111212] Wed, 18 September 2013 08:16 Go to previous message
Maarten Bezemer is currently offline Maarten Bezemer
Messages: 117
Registered: February 2012
Senior Member
Hello Dimitris,

Dimitris Kolovos
I've added a logErrors field to EvlValidator which should allow you to disable error logging [1] and released a new interim version that includes the fix.


Thanks a lot, this version does the trick for me!

Dimitris Kolovos
Regarding LogUtil, we'll need to think about where we should move it a bit more (we'll probably need to split the common.dt plugin and introduce a new feature). Please feel free to file an enhancement request so that we can keep track of this.


I now would like to use the LogUtils to notify the user that error reporting and logging is disabled. So this issue is still current.
I opened Bug #417482 to discuss this further.

Cheers,
Maarten
Previous Topic:[Solved][Eugenia] Patches
Next Topic:org.eclipse.epsilon.emc.emf.virtual.VirtualPackage java.lang.Class Error!
Goto Forum:
  


Current Time: Wed Oct 22 06:47:22 GMT 2014

Powered by FUDForum. Page generated in 0.03526 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software