SEC-1012: Java5 - use of vararg methods.

This commit is contained in:
Luke Taylor 2008-12-06 17:33:19 +00:00
parent c3d216e7bb
commit 7265a70f0a
4 changed files with 6 additions and 6 deletions

View File

@ -105,8 +105,8 @@ public class SecurityContextHolder {
// Try to load a custom strategy
try {
Class<?> clazz = Class.forName(strategyName);
Constructor<?> customStrategy = clazz.getConstructor(new Class[] {});
strategy = (SecurityContextHolderStrategy) customStrategy.newInstance(new Object[] {});
Constructor<?> customStrategy = clazz.getConstructor();
strategy = (SecurityContextHolderStrategy) customStrategy.newInstance();
} catch (Exception ex) {
ReflectionUtils.handleReflectionException(ex);
}

View File

@ -221,7 +221,7 @@ public class ProviderManager extends AbstractAuthenticationManager implements In
Constructor<?> constructor = clazz.getConstructor(new 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");
event = (AbstractAuthenticationEvent) obj;
} catch (ClassNotFoundException ignored) {}

View File

@ -28,7 +28,7 @@ public class AuthenticationDetailsSourceImpl implements AuthenticationDetailsSou
Object result = null;
try {
Constructor<?> constructor = getFirstMatchingConstructor(context);
result = constructor.newInstance(new Object[] { context });
result = constructor.newInstance(context);
} catch (Exception ex) {
ReflectionUtils.handleReflectionException(ex);
}

View File

@ -47,9 +47,9 @@ public class WebAuthenticationDetailsSource implements AuthenticationDetailsSour
public Object buildDetails(Object context) {
Assert.isInstanceOf(HttpServletRequest.class, context);
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) {
ReflectionUtils.handleReflectionException(ex);
} catch (InvocationTargetException ex) {