Explorar o código

SEC-1012: Java5 - use of vararg methods.

Luke Taylor %!s(int64=17) %!d(string=hai) anos
pai
achega
7265a70f0a

+ 2 - 2
core/src/main/java/org/springframework/security/context/SecurityContextHolder.java

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

+ 1 - 1
core/src/main/java/org/springframework/security/providers/ProviderManager.java

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

+ 1 - 1
core/src/main/java/org/springframework/security/ui/AuthenticationDetailsSourceImpl.java

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

+ 2 - 2
core/src/main/java/org/springframework/security/ui/WebAuthenticationDetailsSource.java

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