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 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);
} }

View File

@ -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) {}

View File

@ -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);
} }

View File

@ -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) {