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

[MNG-8082] - Exceptions of proxied SessionScoped components are not working correctly #1449

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

jonasrutishauser
Copy link
Contributor

Simple fix to handle the exception case correctly.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

…orking correctly

Signed-off-by: Jonas Rutishauser <jonas.rutishauser@alumni.ethz.ch>
@gnodet gnodet added this to the 4.0.0-alpha-14 milestone Mar 23, 2024
try {
return method.invoke(getScopeState().scope(key, unscoped).get(), args);
} catch (InvocationTargetException e) {
throw e.getCause();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the target Exception is null, it will throw NPE, and this could affect exception tracing.

Copy link
Contributor Author

@jonasrutishauser jonasrutishauser Mar 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the variable e can never be null.

The statement e.getCause() can be null in theory, but in practice I don't see any case which could give this.
Additional if the cause will be null, we will loose the exception tracing in any case (the only difference is the exception class NullPointerException vs. InvocationTargetException and line number).

Copy link
Member

@CrazyHZM CrazyHZM Mar 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.getCause() return target. I mean e.g Cause() is null, which can affect line numbers.

@gnodet gnodet merged commit aae74df into apache:master Apr 23, 2024
13 checks passed
@jonasrutishauser jonasrutishauser deleted the MNG-8082 branch April 26, 2024 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants