Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If validation throws, getIssueSummary() throws NPE #7

Open
fabtagon opened this issue Nov 14, 2018 · 2 comments
Open

If validation throws, getIssueSummary() throws NPE #7

fabtagon opened this issue Nov 14, 2018 · 2 comments
Labels

Comments

@fabtagon
Copy link

If a validations throws an exceptions, it is caught and, if other than GuardException or NPE, added to a FluentIssueCollection which in turn is evaluated.

As such an exception doesn't posses a URI, getIssueSummary() fails with an NPE in here. Note that the exception thrown by getIssueSummary() is not the exception that the validation has thrown before.

In the best of all worlds, validations do of course not throw, but in reality this might happen (in the best of all worlds where no mistakes occour, validations probably won't be needed at all) - and Xtend seems prepared to deal with exceptions, at least with those other than NPE.

@fabtagon
Copy link
Author

How things do (not) fit together:

Later on,

  • in convertValidatorDiagnostic(), getCauser() gets invoked which returns the EObject under (failing) validation, or in our case of an exception, null
  • this prevents setting the diagnostic's URI two lines later

Suggestion how to resolve:

  • diagnostic should contain text/stack trace of exception, but otherwise refer to the object whose validation has raised the exception (extend functionality in createExceptionDiagnostic())

@kthoms kthoms added the bug label Dec 17, 2018
@kthoms
Copy link

kthoms commented Dec 17, 2018

NPE confirmed.

kthoms pushed a commit that referenced this issue Dec 17, 2018
issue.getUriToProblem() might be null when issues are created from
runtime exceptions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants