1
0

Use final

Use compact array notation
Remove trailing whitespace
This commit is contained in:
Gary Gregory
2023-10-18 17:06:46 -04:00
parent 174f40d168
commit 245211c4bd
15 changed files with 153 additions and 188 deletions

View File

@@ -227,8 +227,8 @@ public abstract class LogFactory {
static { static {
// note: it's safe to call methods before initDiagnostics (though // note: it's safe to call methods before initDiagnostics (though
// diagnostic output gets discarded). // diagnostic output gets discarded).
ClassLoader thisClassLoader = getClassLoader(LogFactory.class); final ClassLoader thisClassLoader = getClassLoader(LogFactory.class);
thisClassLoaderRef = new WeakReference<ClassLoader>(thisClassLoader); thisClassLoaderRef = new WeakReference<>(thisClassLoader);
// In order to avoid confusion where multiple instances of JCL are // In order to avoid confusion where multiple instances of JCL are
// being used via different classloaders within the same app, we // being used via different classloaders within the same app, we
// ensure each logged message has a prefix of form // ensure each logged message has a prefix of form
@@ -305,28 +305,26 @@ public abstract class LogFactory {
logDiagnostic("Loaded class " + logFactoryClass.getName() + logDiagnostic("Loaded class " + logFactoryClass.getName() +
" from classloader " + objectId(classLoader)); " from classloader " + objectId(classLoader));
} }
} else { } else //
// // This indicates a problem with the ClassLoader tree.
// This indicates a problem with the ClassLoader tree. // An incompatible ClassLoader was used to load the
// An incompatible ClassLoader was used to load the // implementation.
// implementation. // As the same classes
// As the same classes // must be available in multiple class loaders,
// must be available in multiple class loaders, // it is very likely that multiple JCL jars are present.
// it is very likely that multiple JCL jars are present. // The most likely fix for this
// The most likely fix for this // problem is to remove the extra JCL jars from the
// problem is to remove the extra JCL jars from the // ClassLoader hierarchy.
// ClassLoader hierarchy. //
// if (isDiagnosticsEnabled()) {
if (isDiagnosticsEnabled()) { logDiagnostic("Factory class " + logFactoryClass.getName() +
logDiagnostic("Factory class " + logFactoryClass.getName() + " loaded from classloader " + objectId(logFactoryClass.getClassLoader()) +
" loaded from classloader " + objectId(logFactoryClass.getClassLoader()) + " does not extend '" + LogFactory.class.getName() +
" does not extend '" + LogFactory.class.getName() + "' as loaded by this classloader.");
"' as loaded by this classloader."); logHierarchy("[BAD CL TREE] ", classLoader);
logHierarchy("[BAD CL TREE] ", classLoader);
}
} }
return (LogFactory) logFactoryClass.getConstructor().newInstance(); return logFactoryClass.getConstructor().newInstance();
} catch (final ClassNotFoundException ex) { } catch (final ClassNotFoundException ex) {
if (classLoader == thisClassLoaderRef.get()) { if (classLoader == thisClassLoaderRef.get()) {
@@ -426,7 +424,7 @@ public abstract class LogFactory {
" - trying the classloader associated with this LogFactory."); " - trying the classloader associated with this LogFactory.");
} }
logFactoryClass = Class.forName(factoryClass); logFactoryClass = Class.forName(factoryClass);
return (LogFactory) logFactoryClass.newInstance(); return logFactoryClass.newInstance();
} catch (final Exception e) { } catch (final Exception e) {
// Check to see if we've got a bad configuration // Check to see if we've got a bad configuration
if (isDiagnosticsEnabled()) { if (isDiagnosticsEnabled()) {
@@ -675,13 +673,11 @@ public abstract class LogFactory {
propsUrl = url; propsUrl = url;
props = newProps; props = newProps;
priority = newPriority; priority = newPriority;
} else { } else if (isDiagnosticsEnabled()) {
if (isDiagnosticsEnabled()) { logDiagnostic("[LOOKUP] Properties file at '" + url + "'" +
logDiagnostic("[LOOKUP] Properties file at '" + url + "'" + " with priority " + newPriority +
" with priority " + newPriority + " does not override file at '" + propsUrl + "'" +
" does not override file at '" + propsUrl + "'" + " with priority " + priority);
" with priority " + priority);
}
} }
} }
@@ -743,12 +739,7 @@ public abstract class LogFactory {
*/ */
private static ClassLoader getContextClassLoaderInternal() throws LogConfigurationException { private static ClassLoader getContextClassLoaderInternal() throws LogConfigurationException {
return (ClassLoader)AccessController.doPrivileged( return (ClassLoader)AccessController.doPrivileged(
new PrivilegedAction() { (PrivilegedAction) LogFactory::directGetContextClassLoader);
@Override
public Object run() {
return directGetContextClassLoader();
}
});
} }
/** /**
@@ -817,7 +808,7 @@ public abstract class LogFactory {
final String useTCCLStr = props.getProperty(TCCL_KEY); final String useTCCLStr = props.getProperty(TCCL_KEY);
// The Boolean.valueOf(useTCCLStr).booleanValue() formulation // The Boolean.valueOf(useTCCLStr).booleanValue() formulation
// is required for Java 1.2 compatibility. // is required for Java 1.2 compatibility.
if ((useTCCLStr != null) && !Boolean.parseBoolean(useTCCLStr)) { if (useTCCLStr != null && !Boolean.parseBoolean(useTCCLStr)) {
// Don't use current context classloader when locating any // Don't use current context classloader when locating any
// LogFactory or Log classes, just use the class that loaded // LogFactory or Log classes, just use the class that loaded
// this abstract class. When this class is deployed in a shared // this abstract class. When this class is deployed in a shared
@@ -844,10 +835,8 @@ public abstract class LogFactory {
"' as specified by system property " + FACTORY_PROPERTY); "' as specified by system property " + FACTORY_PROPERTY);
} }
factory = newFactory(factoryClass, baseClassLoader, contextClassLoader); factory = newFactory(factoryClass, baseClassLoader, contextClassLoader);
} else { } else if (isDiagnosticsEnabled()) {
if (isDiagnosticsEnabled()) { logDiagnostic("[LOOKUP] No system property [" + FACTORY_PROPERTY + "] defined.");
logDiagnostic("[LOOKUP] No system property [" + FACTORY_PROPERTY + "] defined.");
}
} }
} catch (final SecurityException e) { } catch (final SecurityException e) {
if (isDiagnosticsEnabled()) { if (isDiagnosticsEnabled()) {
@@ -938,10 +927,8 @@ public abstract class LogFactory {
logDiagnostic("[LOOKUP] Properties file has no entry specifying LogFactory subclass."); logDiagnostic("[LOOKUP] Properties file has no entry specifying LogFactory subclass.");
} }
} }
} else { } else if (isDiagnosticsEnabled()) {
if (isDiagnosticsEnabled()) { logDiagnostic("[LOOKUP] No properties file available to determine" + " LogFactory subclass from..");
logDiagnostic("[LOOKUP] No properties file available to determine" + " LogFactory subclass from..");
}
} }
} }
@@ -1019,44 +1006,41 @@ public abstract class LogFactory {
*/ */
private static Properties getProperties(final URL url) { private static Properties getProperties(final URL url) {
final PrivilegedAction action = final PrivilegedAction action =
new PrivilegedAction() { () -> {
@Override InputStream stream = null;
public Object run() { try {
InputStream stream = null; // We must ensure that useCaches is set to false, as the
// default behavior of java is to cache file handles, and
// this "locks" files, preventing hot-redeploy on windows.
final URLConnection connection = url.openConnection();
connection.setUseCaches(false);
stream = connection.getInputStream();
if (stream != null) {
final Properties props = new Properties();
props.load(stream);
stream.close();
stream = null;
return props;
}
} catch (final IOException e) {
if (isDiagnosticsEnabled()) {
logDiagnostic("Unable to read URL " + url);
}
} finally {
if (stream != null) {
try { try {
// We must ensure that useCaches is set to false, as the stream.close();
// default behavior of java is to cache file handles, and
// this "locks" files, preventing hot-redeploy on windows.
final URLConnection connection = url.openConnection();
connection.setUseCaches(false);
stream = connection.getInputStream();
if (stream != null) {
final Properties props = new Properties();
props.load(stream);
stream.close();
stream = null;
return props;
}
} catch (final IOException e) { } catch (final IOException e) {
// ignore exception; this should not happen
if (isDiagnosticsEnabled()) { if (isDiagnosticsEnabled()) {
logDiagnostic("Unable to read URL " + url); logDiagnostic("Unable to close stream for URL " + url);
}
} finally {
if (stream != null) {
try {
stream.close();
} catch (final IOException e) {
// ignore exception; this should not happen
if (isDiagnosticsEnabled()) {
logDiagnostic("Unable to close stream for URL " + url);
}
}
} }
} }
return null;
} }
}; }
return null;
};
return (Properties) AccessController.doPrivileged(action); return (Properties) AccessController.doPrivileged(action);
} }
@@ -1068,14 +1052,11 @@ public abstract class LogFactory {
*/ */
private static InputStream getResourceAsStream(final ClassLoader loader, final String name) { private static InputStream getResourceAsStream(final ClassLoader loader, final String name) {
return (InputStream)AccessController.doPrivileged( return (InputStream)AccessController.doPrivileged(
new PrivilegedAction() { (PrivilegedAction) () -> {
@Override if (loader != null) {
public Object run() { return loader.getResourceAsStream(name);
if (loader != null) {
return loader.getResourceAsStream(name);
}
return ClassLoader.getSystemResourceAsStream(name);
} }
return ClassLoader.getSystemResourceAsStream(name);
}); });
} }
@@ -1094,28 +1075,25 @@ public abstract class LogFactory {
*/ */
private static Enumeration getResources(final ClassLoader loader, final String name) { private static Enumeration getResources(final ClassLoader loader, final String name) {
final PrivilegedAction action = final PrivilegedAction action =
new PrivilegedAction() { () -> {
@Override try {
public Object run() { if (loader != null) {
try { return loader.getResources(name);
if (loader != null) {
return loader.getResources(name);
}
return ClassLoader.getSystemResources(name);
} catch (final IOException e) {
if (isDiagnosticsEnabled()) {
logDiagnostic("Exception while trying to find configuration file " +
name + ":" + e.getMessage());
}
return null;
} catch (final NoSuchMethodError e) {
// we must be running on a 1.1 JVM which doesn't support
// ClassLoader.getSystemResources; just return null in
// this case.
return null;
}
} }
}; return ClassLoader.getSystemResources(name);
} catch (final IOException e) {
if (isDiagnosticsEnabled()) {
logDiagnostic("Exception while trying to find configuration file " +
name + ":" + e.getMessage());
}
return null;
} catch (final NoSuchMethodError e) {
// we must be running on a 1.1 JVM which doesn't support
// ClassLoader.getSystemResources; just return null in
// this case.
return null;
}
};
final Object result = AccessController.doPrivileged(action); final Object result = AccessController.doPrivileged(action);
return (Enumeration) result; return (Enumeration) result;
} }
@@ -1134,12 +1112,7 @@ public abstract class LogFactory {
private static String getSystemProperty(final String key, final String def) private static String getSystemProperty(final String key, final String def)
throws SecurityException { throws SecurityException {
return (String) AccessController.doPrivileged( return (String) AccessController.doPrivileged(
new PrivilegedAction() { (PrivilegedAction) () -> System.getProperty(key, def));
@Override
public Object run() {
return System.getProperty(key, def);
}
});
} }
/** /**
@@ -1475,12 +1448,7 @@ public abstract class LogFactory {
// method will propagate out of this method; in particular a // method will propagate out of this method; in particular a
// ClassCastException can be thrown. // ClassCastException can be thrown.
final Object result = AccessController.doPrivileged( final Object result = AccessController.doPrivileged(
new PrivilegedAction() { (PrivilegedAction) () -> createFactory(factoryClass, classLoader));
@Override
public Object run() {
return createFactory(factoryClass, classLoader);
}
});
if (result instanceof LogConfigurationException) { if (result instanceof LogConfigurationException) {
final LogConfigurationException ex = (LogConfigurationException) result; final LogConfigurationException ex = (LogConfigurationException) result;

View File

@@ -72,7 +72,7 @@ public class LogSource {
/** /**
* An empty immutable {@code String} array. * An empty immutable {@code String} array.
*/ */
private static final String[] EMPTY_STRING_ARRAY = new String[0]; private static final String[] EMPTY_STRING_ARRAY = {};
// ----------------------------------------------------- Class Initializers // ----------------------------------------------------- Class Initializers

View File

@@ -236,16 +236,13 @@ public class SimpleLog implements Log, Serializable {
private static InputStream getResourceAsStream(final String name) { private static InputStream getResourceAsStream(final String name) {
return (InputStream)AccessController.doPrivileged( return (InputStream)AccessController.doPrivileged(
new PrivilegedAction() { (PrivilegedAction) () -> {
@Override final ClassLoader threadCL = getContextClassLoader();
public Object run() {
final ClassLoader threadCL = getContextClassLoader();
if (threadCL != null) { if (threadCL != null) {
return threadCL.getResourceAsStream(name); return threadCL.getResourceAsStream(name);
}
return ClassLoader.getSystemResourceAsStream(name);
} }
return ClassLoader.getSystemResourceAsStream(name);
}); });
} }

View File

@@ -35,7 +35,7 @@ public final class GarbageCollectionHelper implements Closeable, Runnable {
// Allocate data to help suggest a GC // Allocate data to help suggest a GC
try { try {
// 1mb of heap // 1mb of heap
byte[] buf = new byte[1024 * 1024]; final byte[] buf = new byte[1024 * 1024];
SINK.write(buf); SINK.write(buf);
} catch (final IOException ignored) { } catch (final IOException ignored) {
} }
@@ -49,15 +49,15 @@ public final class GarbageCollectionHelper implements Closeable, Runnable {
} }
private static final OutputStream SINK = new OutputStream() { private static final OutputStream SINK = new OutputStream() {
@Override @Override
public void write(byte[] b) { public void write(final byte[] b) {
} }
@Override @Override
public void write(byte[] b, int off, int len) { public void write(final byte[] b, final int off, final int len) {
} }
@Override @Override
public void write(int b) { public void write(final int b) {
} }
}; };
private final AtomicBoolean running = new AtomicBoolean(); private final AtomicBoolean running = new AtomicBoolean();

View File

@@ -37,7 +37,7 @@ public class LogFactoryWeakReferenceTestCase extends TestCase {
// reflection hacks to obtain the weak reference // reflection hacks to obtain the weak reference
Field field = logFactoryClass.getDeclaredField("thisClassLoaderRef"); Field field = logFactoryClass.getDeclaredField("thisClassLoaderRef");
field.setAccessible(true); field.setAccessible(true);
WeakReference thisClassLoaderRef = (WeakReference) field.get(null); final WeakReference thisClassLoaderRef = (WeakReference) field.get(null);
// the ref should at this point contain the loader // the ref should at this point contain the loader
assertSame(loader, thisClassLoaderRef.get()); assertSame(loader, thisClassLoaderRef.get());
@@ -48,10 +48,10 @@ public class LogFactoryWeakReferenceTestCase extends TestCase {
loader.close(); loader.close();
loader = null; loader = null;
GarbageCollectionHelper gcHelper = new GarbageCollectionHelper(); final GarbageCollectionHelper gcHelper = new GarbageCollectionHelper();
gcHelper.run(); gcHelper.run();
try { try {
long start = System.currentTimeMillis(); final long start = System.currentTimeMillis();
while (thisClassLoaderRef.get() != null) { while (thisClassLoaderRef.get() != null) {
if (System.currentTimeMillis() - start > MAX_WAIT_FOR_REF_NULLED_BY_GC) { if (System.currentTimeMillis() - start > MAX_WAIT_FOR_REF_NULLED_BY_GC) {
fail("After waiting " + MAX_WAIT_FOR_REF_NULLED_BY_GC + "ms, the weak ref still yields a non-null value."); fail("After waiting " + MAX_WAIT_FOR_REF_NULLED_BY_GC + "ms, the weak ref still yields a non-null value.");

View File

@@ -48,7 +48,7 @@ import java.util.Map;
public class PathableClassLoader extends URLClassLoader { public class PathableClassLoader extends URLClassLoader {
private static final URL[] NO_URLS = new URL[0]; private static final URL[] NO_URLS = {};
/** /**
* A map of package-prefix to ClassLoader. Any class which is in * A map of package-prefix to ClassLoader. Any class which is in

View File

@@ -75,12 +75,12 @@ public class WeakHashtableTestCase extends TestCase {
super.setUp(); super.setUp();
weakHashtable = new WeakHashtable(); weakHashtable = new WeakHashtable();
keyOne = new Long(1); keyOne = Long.valueOf(1);
keyTwo = new Long(2); keyTwo = Long.valueOf(2);
keyThree = new Long(3); keyThree = Long.valueOf(3);
valueOne = new Long(100); valueOne = Long.valueOf(100);
valueTwo = new Long(200); valueTwo = Long.valueOf(200);
valueThree = new Long(300); valueThree = Long.valueOf(300);
weakHashtable.put(keyOne, valueOne); weakHashtable.put(keyOne, valueOne);
weakHashtable.put(keyTwo, valueTwo); weakHashtable.put(keyTwo, valueTwo);
@@ -89,35 +89,35 @@ public class WeakHashtableTestCase extends TestCase {
/** Tests public boolean contains(Object value) */ /** Tests public boolean contains(Object value) */
public void testContains() throws Exception { public void testContains() throws Exception {
assertFalse(weakHashtable.contains(new Long(1))); assertFalse(weakHashtable.contains(Long.valueOf(1)));
assertFalse(weakHashtable.contains(new Long(2))); assertFalse(weakHashtable.contains(Long.valueOf(2)));
assertFalse(weakHashtable.contains(new Long(3))); assertFalse(weakHashtable.contains(Long.valueOf(3)));
assertTrue(weakHashtable.contains(new Long(100))); assertTrue(weakHashtable.contains(Long.valueOf(100)));
assertTrue(weakHashtable.contains(new Long(200))); assertTrue(weakHashtable.contains(Long.valueOf(200)));
assertTrue(weakHashtable.contains(new Long(300))); assertTrue(weakHashtable.contains(Long.valueOf(300)));
assertFalse(weakHashtable.contains(new Long(400))); assertFalse(weakHashtable.contains(Long.valueOf(400)));
} }
/** Tests public boolean containsKey(Object key) */ /** Tests public boolean containsKey(Object key) */
public void testContainsKey() throws Exception { public void testContainsKey() throws Exception {
assertTrue(weakHashtable.containsKey(new Long(1))); assertTrue(weakHashtable.containsKey(Long.valueOf(1)));
assertTrue(weakHashtable.containsKey(new Long(2))); assertTrue(weakHashtable.containsKey(Long.valueOf(2)));
assertTrue(weakHashtable.containsKey(new Long(3))); assertTrue(weakHashtable.containsKey(Long.valueOf(3)));
assertFalse(weakHashtable.containsKey(new Long(100))); assertFalse(weakHashtable.containsKey(Long.valueOf(100)));
assertFalse(weakHashtable.containsKey(new Long(200))); assertFalse(weakHashtable.containsKey(Long.valueOf(200)));
assertFalse(weakHashtable.containsKey(new Long(300))); assertFalse(weakHashtable.containsKey(Long.valueOf(300)));
assertFalse(weakHashtable.containsKey(new Long(400))); assertFalse(weakHashtable.containsKey(Long.valueOf(400)));
} }
/** Tests public boolean containsValue(Object value) */ /** Tests public boolean containsValue(Object value) */
public void testContainsValue() throws Exception { public void testContainsValue() throws Exception {
assertFalse(weakHashtable.containsValue(new Long(1))); assertFalse(weakHashtable.containsValue(Long.valueOf(1)));
assertFalse(weakHashtable.containsValue(new Long(2))); assertFalse(weakHashtable.containsValue(Long.valueOf(2)));
assertFalse(weakHashtable.containsValue(new Long(3))); assertFalse(weakHashtable.containsValue(Long.valueOf(3)));
assertTrue(weakHashtable.containsValue(new Long(100))); assertTrue(weakHashtable.containsValue(Long.valueOf(100)));
assertTrue(weakHashtable.containsValue(new Long(200))); assertTrue(weakHashtable.containsValue(Long.valueOf(200)));
assertTrue(weakHashtable.containsValue(new Long(300))); assertTrue(weakHashtable.containsValue(Long.valueOf(300)));
assertFalse(weakHashtable.containsValue(new Long(400))); assertFalse(weakHashtable.containsValue(Long.valueOf(400)));
} }
/** Tests public Enumeration elements() */ /** Tests public Enumeration elements() */
@@ -155,7 +155,7 @@ public class WeakHashtableTestCase extends TestCase {
assertEquals(valueOne, weakHashtable.get(keyOne)); assertEquals(valueOne, weakHashtable.get(keyOne));
assertEquals(valueTwo, weakHashtable.get(keyTwo)); assertEquals(valueTwo, weakHashtable.get(keyTwo));
assertEquals(valueThree, weakHashtable.get(keyThree)); assertEquals(valueThree, weakHashtable.get(keyThree));
assertNull(weakHashtable.get(new Long(50))); assertNull(weakHashtable.get(Long.valueOf(50)));
} }
/** Tests public Enumeration keys() */ /** Tests public Enumeration keys() */
@@ -208,10 +208,10 @@ public class WeakHashtableTestCase extends TestCase {
/** Tests public Object put(Object key, Object value) */ /** Tests public Object put(Object key, Object value) */
public void testPut() throws Exception { public void testPut() throws Exception {
final Long anotherKey = new Long(2004); final Long anotherKey = Long.valueOf(2004);
weakHashtable.put(anotherKey, new Long(1066)); weakHashtable.put(anotherKey, Long.valueOf(1066));
assertEquals(new Long(1066), weakHashtable.get(anotherKey)); assertEquals(Long.valueOf(1066), weakHashtable.get(anotherKey));
// Test compliance with the hashtable API re nulls // Test compliance with the hashtable API re nulls
Exception caught = null; Exception caught = null;
@@ -235,11 +235,11 @@ public class WeakHashtableTestCase extends TestCase {
/** Tests public void putAll(Map t) */ /** Tests public void putAll(Map t) */
public void testPutAll() throws Exception { public void testPutAll() throws Exception {
final Map newValues = new HashMap(); final Map newValues = new HashMap();
final Long newKey = new Long(1066); final Long newKey = Long.valueOf(1066);
final Long newValue = new Long(1415); final Long newValue = Long.valueOf(1415);
newValues.put(newKey, newValue); newValues.put(newKey, newValue);
final Long anotherNewKey = new Long(1645); final Long anotherNewKey = Long.valueOf(1645);
final Long anotherNewValue = new Long(1815); final Long anotherNewValue = Long.valueOf(1815);
newValues.put(anotherNewKey, anotherNewValue); newValues.put(anotherNewKey, anotherNewValue);
weakHashtable.putAll(newValues); weakHashtable.putAll(newValues);
@@ -272,7 +272,7 @@ public class WeakHashtableTestCase extends TestCase {
* IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 Linux x86-32 jvmxi3260sr12-20121024_1 * IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 Linux x86-32 jvmxi3260sr12-20121024_1
*/ */
public void xxxIgnoretestRelease() throws Exception { public void xxxIgnoretestRelease() throws Exception {
assertNotNull(weakHashtable.get(new Long(1))); assertNotNull(weakHashtable.get(Long.valueOf(1)));
final ReferenceQueue testQueue = new ReferenceQueue(); final ReferenceQueue testQueue = new ReferenceQueue();
final WeakReference weakKeyOne = new WeakReference(keyOne, testQueue); final WeakReference weakKeyOne = new WeakReference(keyOne, testQueue);
@@ -292,7 +292,7 @@ public class WeakHashtableTestCase extends TestCase {
fail("Max iterations reached before resource released."); fail("Max iterations reached before resource released.");
} }
if (weakHashtable.get(new Long(1)) == null) { if (weakHashtable.get(Long.valueOf(1)) == null) {
break; break;
} }

View File

@@ -67,14 +67,14 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
final ClassLoader srcCL = CustomConfigAPITestCase.class.getClassLoader(); final ClassLoader srcCL = CustomConfigAPITestCase.class.getClassLoader();
final byte[] classData = readClass(className, srcCL); final byte[] classData = readClass(className, srcCL);
final Class[] params = new Class[] { String.class, classData.getClass(), Integer.TYPE, Integer.TYPE }; final Class[] params = { String.class, classData.getClass(), Integer.TYPE, Integer.TYPE };
final Method m = ClassLoader.class.getDeclaredMethod("defineClass", params); final Method m = ClassLoader.class.getDeclaredMethod("defineClass", params);
final Object[] args = new Object[4]; final Object[] args = new Object[4];
args[0] = className; args[0] = className;
args[1] = classData; args[1] = classData;
args[2] = new Integer(0); args[2] = Integer.valueOf(0);
args[3] = new Integer(classData.length); args[3] = Integer.valueOf(classData.length);
m.setAccessible(true); m.setAccessible(true);
m.invoke(targetCL, args); m.invoke(targetCL, args);
} catch (final Exception e) { } catch (final Exception e) {

View File

@@ -41,7 +41,7 @@ public class GeneralTestCase extends TestCase {
contextLoader.getClass().getName(), contextLoader.getClass().getName(),
PathableClassLoader.class.getName()); PathableClassLoader.class.getName());
final URL[] noUrls = new URL[0]; final URL[] noUrls = {};
Thread.currentThread().setContextClassLoader(new URLClassLoader(noUrls)); Thread.currentThread().setContextClassLoader(new URLClassLoader(noUrls));
} }

View File

@@ -22,7 +22,7 @@ import org.apache.commons.logging.LogFactory;
public class DummyLogFactory extends LogFactory { public class DummyLogFactory extends LogFactory {
@Override @Override
public Object getAttribute(String name) { public Object getAttribute(final String name) {
return null; return null;
} }
@@ -32,12 +32,12 @@ public class DummyLogFactory extends LogFactory {
} }
@Override @Override
public Log getInstance(Class clazz) throws LogConfigurationException { public Log getInstance(final Class clazz) throws LogConfigurationException {
return null; return null;
} }
@Override @Override
public Log getInstance(String name) throws LogConfigurationException { public Log getInstance(final String name) throws LogConfigurationException {
return null; return null;
} }
@@ -47,12 +47,12 @@ public class DummyLogFactory extends LogFactory {
} }
@Override @Override
public void removeAttribute(String name) { public void removeAttribute(final String name) {
// empty // empty
} }
@Override @Override
public void setAttribute(String name, Object value) { public void setAttribute(final String name, final Object value) {
// empty // empty
} }
} }