mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-09 03:52:48 +00:00
SEC-1012: Java5 - use of vararg methods.
This commit is contained in:
parent
c3d216e7bb
commit
7265a70f0a
@ -105,8 +105,8 @@ public class SecurityContextHolder {
|
|||||||
// Try to load a custom strategy
|
// Try to load a custom strategy
|
||||||
try {
|
try {
|
||||||
Class<?> clazz = Class.forName(strategyName);
|
Class<?> clazz = Class.forName(strategyName);
|
||||||
Constructor<?> customStrategy = clazz.getConstructor(new Class[] {});
|
Constructor<?> customStrategy = clazz.getConstructor();
|
||||||
strategy = (SecurityContextHolderStrategy) customStrategy.newInstance(new Object[] {});
|
strategy = (SecurityContextHolderStrategy) customStrategy.newInstance();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ReflectionUtils.handleReflectionException(ex);
|
ReflectionUtils.handleReflectionException(ex);
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ public class ProviderManager extends AbstractAuthenticationManager implements In
|
|||||||
Constructor<?> constructor = clazz.getConstructor(new Class[] {
|
Constructor<?> constructor = clazz.getConstructor(new Class[] {
|
||||||
Authentication.class, AuthenticationException.class
|
Authentication.class, AuthenticationException.class
|
||||||
});
|
});
|
||||||
Object obj = constructor.newInstance(new Object[] {authentication, exception});
|
Object obj = constructor.newInstance(authentication, exception);
|
||||||
Assert.isInstanceOf(AbstractAuthenticationEvent.class, obj, "Must be an AbstractAuthenticationEvent");
|
Assert.isInstanceOf(AbstractAuthenticationEvent.class, obj, "Must be an AbstractAuthenticationEvent");
|
||||||
event = (AbstractAuthenticationEvent) obj;
|
event = (AbstractAuthenticationEvent) obj;
|
||||||
} catch (ClassNotFoundException ignored) {}
|
} catch (ClassNotFoundException ignored) {}
|
||||||
|
@ -28,7 +28,7 @@ public class AuthenticationDetailsSourceImpl implements AuthenticationDetailsSou
|
|||||||
Object result = null;
|
Object result = null;
|
||||||
try {
|
try {
|
||||||
Constructor<?> constructor = getFirstMatchingConstructor(context);
|
Constructor<?> constructor = getFirstMatchingConstructor(context);
|
||||||
result = constructor.newInstance(new Object[] { context });
|
result = constructor.newInstance(context);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ReflectionUtils.handleReflectionException(ex);
|
ReflectionUtils.handleReflectionException(ex);
|
||||||
}
|
}
|
||||||
|
@ -47,9 +47,9 @@ public class WebAuthenticationDetailsSource implements AuthenticationDetailsSour
|
|||||||
public Object buildDetails(Object context) {
|
public Object buildDetails(Object context) {
|
||||||
Assert.isInstanceOf(HttpServletRequest.class, context);
|
Assert.isInstanceOf(HttpServletRequest.class, context);
|
||||||
try {
|
try {
|
||||||
Constructor<?> constructor = clazz.getConstructor(new Class[] {HttpServletRequest.class});
|
Constructor<?> constructor = clazz.getConstructor(HttpServletRequest.class);
|
||||||
|
|
||||||
return constructor.newInstance(new Object[] {context});
|
return constructor.newInstance(context);
|
||||||
} catch (NoSuchMethodException ex) {
|
} catch (NoSuchMethodException ex) {
|
||||||
ReflectionUtils.handleReflectionException(ex);
|
ReflectionUtils.handleReflectionException(ex);
|
||||||
} catch (InvocationTargetException ex) {
|
} catch (InvocationTargetException ex) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user