Skip to content

Commit

Permalink
Propagate target exception
Browse files Browse the repository at this point in the history
Closes gh-660
  • Loading branch information
jzheaux committed Oct 11, 2024
1 parent d9180f0 commit 3d929dd
Showing 1 changed file with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -15,9 +15,12 @@
*/
package org.springframework.ldap.core.support;

import org.springframework.ldap.UncategorizedLdapException;
import org.springframework.ldap.core.DirContextProxy;
import org.springframework.ldap.support.LdapUtils;
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;

import javax.naming.NamingException;
import javax.naming.directory.DirContext;
Expand All @@ -26,11 +29,10 @@
import javax.naming.ldap.StartTlsResponse;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSocketFactory;
import java.io.IOException;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Hashtable;

import org.springframework.ldap.UncategorizedLdapException;
import org.springframework.ldap.core.DirContextProxy;
import org.springframework.ldap.support.LdapUtils;

/**
* Abstract superclass for {@link DirContextAuthenticationStrategy}
Expand Down Expand Up @@ -199,7 +201,11 @@ else if (method.getName().equals(GET_TARGET_CONTEXT_METHOD_NAME)) {
return target;
}
else {
return method.invoke(target, args);
try {
return method.invoke(target, args);
} catch (InvocationTargetException ex) {
throw ex.getTargetException();
}
}
}
}
Expand Down

0 comments on commit 3d929dd

Please sign in to comment.