1
0

Use varargs.

This commit is contained in:
Gary Gregory
2021-02-28 17:54:22 -05:00
parent c2afed56ab
commit 7bd861788d
3 changed files with 5 additions and 5 deletions

View File

@@ -106,7 +106,7 @@ public class LoadTestCase extends TestCase{
private void setAllowFlawedContext(final Class c, final String state) throws Exception { private void setAllowFlawedContext(final Class c, final String state) throws Exception {
final Class[] params = {String.class}; final Class[] params = {String.class};
final java.lang.reflect.Method m = c.getDeclaredMethod("setAllowFlawedContext", params); final java.lang.reflect.Method m = c.getDeclaredMethod("setAllowFlawedContext", params);
m.invoke(null, new Object[] {state}); m.invoke(null, state);
} }
/** /**

View File

@@ -99,8 +99,8 @@ public class SecurityAllowedTestCase extends TestCase
// initializer for the LogFactory class is executed. // initializer for the LogFactory class is executed.
final Class c = this.getClass().getClassLoader().loadClass( final Class c = this.getClass().getClassLoader().loadClass(
"org.apache.commons.logging.LogFactory"); "org.apache.commons.logging.LogFactory");
final Method m = c.getMethod("getLog", new Class[] {Class.class}); final Method m = c.getMethod("getLog", Class.class);
final Log log = (Log) m.invoke(null, new Object[] {this.getClass()}); final Log log = (Log) m.invoke(null, this.getClass());
// Check whether we had any security exceptions so far (which were // Check whether we had any security exceptions so far (which were
// caught by the code). We should not, as every secure operation // caught by the code). We should not, as every secure operation

View File

@@ -110,8 +110,8 @@ public class SecurityForbiddenTestCase extends TestCase
// initializer for the LogFactory class is executed. // initializer for the LogFactory class is executed.
final Class c = this.getClass().getClassLoader().loadClass( final Class c = this.getClass().getClassLoader().loadClass(
"org.apache.commons.logging.LogFactory"); "org.apache.commons.logging.LogFactory");
final Method m = c.getMethod("getLog", new Class[] {Class.class}); final Method m = c.getMethod("getLog", Class.class);
final Log log = (Log) m.invoke(null, new Object[] {this.getClass()}); final Log log = (Log) m.invoke(null, this.getClass());
log.info("testing"); log.info("testing");
// check that the default map implementation was loaded, as JCL was // check that the default map implementation was loaded, as JCL was