From 7bb0a7c20e23d80fb5940ab89080daf1c5e73a88 Mon Sep 17 00:00:00 2001 From: Josh Cummings Date: Fri, 11 Oct 2024 16:29:12 -0600 Subject: [PATCH] Propagate target exception Closes gh-660 --- .../AbstractTlsDirContextAuthenticationStrategy.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/springframework/ldap/core/support/AbstractTlsDirContextAuthenticationStrategy.java b/core/src/main/java/org/springframework/ldap/core/support/AbstractTlsDirContextAuthenticationStrategy.java index 11cca7f9..375214cb 100755 --- a/core/src/main/java/org/springframework/ldap/core/support/AbstractTlsDirContextAuthenticationStrategy.java +++ b/core/src/main/java/org/springframework/ldap/core/support/AbstractTlsDirContextAuthenticationStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package org.springframework.ldap.core.support; import java.io.IOException; import java.lang.reflect.InvocationHandler; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.Hashtable; @@ -203,7 +204,12 @@ public abstract class AbstractTlsDirContextAuthenticationStrategy implements Dir return this.target; } else { - return method.invoke(this.target, args); + try { + return method.invoke(this.target, args); + } + catch (InvocationTargetException ex) { + throw ex.getTargetException(); + } } }