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


##########
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:
   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).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to