Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353194 - AbstractDeclarativeValidator: Don't wrap RuntimeException in a RuntimeException
Summary: AbstractDeclarativeValidator: Don't wrap RuntimeException in a RuntimeException
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 trivial (vote)
Target Milestone: SR2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-27 06:40 EDT by Karsten Thoms CLA
Modified: 2017-09-19 17:26 EDT (History)
1 user (show)

See Also:
sebastian.zarnekow: indigo+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karsten Thoms CLA 2011-07-27 06:40:47 EDT
In AbstractDeclarativeValidator#invoke() the target of a InvocationTargetException is thrown as a RuntimeException. It is not necessary to wrap it when the target is already a RuntimeException, in this case just throw that instance.



        catch (InvocationTargetException e) {
          // ignore GuardException, check is just not evaluated if
          // guard is false
          // ignore NullPointerException, as not having to check for
          // NPEs all the time is a convenience feature
          Throwable targetException = e.getTargetException();
          if (!(targetException instanceof GuardException)
              && !(targetException instanceof NullPointerException))
            if (targetException instanceof RuntimeException)
               throw targetException;
            else
               throw new RuntimeException(targetException);
        }
Comment 1 Sebastian Zarnekow CLA 2011-08-16 17:21:55 EDT
Pushed to master.

Out of curiosity: Have you had any actual problems with the wrapped runtime exception?
Comment 2 Karsten Thoms CLA 2011-08-23 02:50:23 EDT
No, this caused no problems. Just noticed that I have an unnecessary wrapped exception.
Comment 3 Karsten Thoms CLA 2017-09-19 17:14:49 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 4 Karsten Thoms CLA 2017-09-19 17:26:25 EDT
Closing all bugs that were set to RESOLVED before Neon.0