Remove variable assignment just before returning it
Use final
This commit is contained in:
@@ -317,8 +317,7 @@ public class PathableClassLoader extends URLClassLoader {
|
||||
final String prefix = (String) entry.getKey();
|
||||
if (name.startsWith(prefix)) {
|
||||
final ClassLoader loader = (ClassLoader) entry.getValue();
|
||||
final Class clazz = Class.forName(name, resolve, loader);
|
||||
return clazz;
|
||||
return Class.forName(name, resolve, loader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,6 @@ public class AvalonLoggerTestCase extends AbstractLogTest {
|
||||
|
||||
@Override
|
||||
public Log getLogObject() {
|
||||
// Output does not seem to be used, so don't display it.
|
||||
final Log log = new AvalonLogger(new NullLogger());
|
||||
return log;
|
||||
return new AvalonLogger(new NullLogger());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,8 +82,7 @@ public class SecurityForbiddenTestCase extends TestCase {
|
||||
private Object loadClass(final String name, final ClassLoader classLoader) {
|
||||
try {
|
||||
final Class clazz = classLoader.loadClass(name);
|
||||
final Object obj = clazz.getConstructor().newInstance();
|
||||
return obj;
|
||||
return clazz.getConstructor().newInstance();
|
||||
} catch (final Exception e) {
|
||||
final StringWriter sw = new StringWriter();
|
||||
final PrintWriter pw = new PrintWriter(sw);
|
||||
|
||||
@@ -60,7 +60,7 @@ public class CallerInformationTestCase extends TestCase {
|
||||
appender.clearAllFilters();
|
||||
appender.addFilter(new Filter<ILoggingEvent>() {
|
||||
@Override
|
||||
public FilterReply decide(ILoggingEvent event) {
|
||||
public FilterReply decide(final ILoggingEvent event) {
|
||||
// Force the registration of caller data
|
||||
event.getCallerData();
|
||||
return FilterReply.NEUTRAL;
|
||||
|
||||
@@ -32,8 +32,7 @@ public class BadTCCLTestCase extends TestCase {
|
||||
public static Test suite() throws Exception {
|
||||
final PathableClassLoader contextClassLoader = new PathableClassLoader(null);
|
||||
contextClassLoader.useExplicitLoader("junit.", Test.class.getClassLoader());
|
||||
final PathableTestSuite suite = new PathableTestSuite(BadTCCLTestCase.class, contextClassLoader);
|
||||
return suite;
|
||||
return new PathableTestSuite(BadTCCLTestCase.class, contextClassLoader);
|
||||
}
|
||||
|
||||
// test methods
|
||||
|
||||
@@ -29,8 +29,7 @@ import junit.framework.TestCase;
|
||||
public class NullTCCLTestCase extends TestCase {
|
||||
|
||||
public static Test suite() throws Exception {
|
||||
final PathableTestSuite suite = new PathableTestSuite(NullTCCLTestCase.class, null);
|
||||
return suite;
|
||||
return new PathableTestSuite(NullTCCLTestCase.class, null);
|
||||
}
|
||||
|
||||
// test methods
|
||||
|
||||
Reference in New Issue
Block a user