[ 
https://issues.apache.org/jira/browse/MNG-8082?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17830213#comment-17830213
 ] 

ASF GitHub Bot commented on MNG-8082:
-------------------------------------

CrazyHZM commented on code in PR #1449:
URL: https://github.com/apache/maven/pull/1449#discussion_r1536759020


##########
maven-core/src/main/java/org/apache/maven/session/scope/internal/SessionScope.java:
##########
@@ -107,7 +107,11 @@ public <T> Provider<T> scope(final Key<T> key, final 
Provider<T> unscoped) {
     private <T> T createProxy(Key<T> key, Provider<T> unscoped) {
         InvocationHandler dispatcher = (proxy, method, args) -> {
             method.setAccessible(true);
-            return method.invoke(getScopeState().scope(key, unscoped).get(), 
args);
+            try {
+                return method.invoke(getScopeState().scope(key, 
unscoped).get(), args);
+            } catch (InvocationTargetException e) {
+                throw e.getCause();

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





> Exceptions of proxied SessionScoped components are not working correctly
> ------------------------------------------------------------------------
>
>                 Key: MNG-8082
>                 URL: https://issues.apache.org/jira/browse/MNG-8082
>             Project: Maven
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 4.0.0-alpha-13
>            Reporter: Jonas Rutishauser
>            Priority: Major
>
> As the {{InvocationTargetException}} is not handled in the proxy a runtime 
> exception will be wrapped by an {{InvocationTargetException}} and an 
> application exception is additional wrapped by an 
> {{UndeclaredThrowableException}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to