| Summary: | AbstractDeclarativeValidator: Don't wrap RuntimeException in a RuntimeException | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Karsten Thoms <karsten.thoms> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | trivial | ||
| Priority: | P3 | CC: | sebastian.zarnekow |
| Version: | 2.0.0 | Flags: | sebastian.zarnekow:
indigo+
|
| Target Milestone: | SR2 | ||
| Hardware: | PC | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
Pushed to master. Out of curiosity: Have you had any actual problems with the wrapped runtime exception? No, this caused no problems. Just noticed that I have an unnecessary wrapped exception. Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |
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); }