Use final
Use compact array notation Remove trailing whitespace
This commit is contained in:
@@ -227,8 +227,8 @@ public abstract class LogFactory {
|
||||
static {
|
||||
// note: it's safe to call methods before initDiagnostics (though
|
||||
// diagnostic output gets discarded).
|
||||
ClassLoader thisClassLoader = getClassLoader(LogFactory.class);
|
||||
thisClassLoaderRef = new WeakReference<ClassLoader>(thisClassLoader);
|
||||
final ClassLoader thisClassLoader = getClassLoader(LogFactory.class);
|
||||
thisClassLoaderRef = new WeakReference<>(thisClassLoader);
|
||||
// In order to avoid confusion where multiple instances of JCL are
|
||||
// being used via different classloaders within the same app, we
|
||||
// ensure each logged message has a prefix of form
|
||||
@@ -305,28 +305,26 @@ public abstract class LogFactory {
|
||||
logDiagnostic("Loaded class " + logFactoryClass.getName() +
|
||||
" from classloader " + objectId(classLoader));
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// This indicates a problem with the ClassLoader tree.
|
||||
// An incompatible ClassLoader was used to load the
|
||||
// implementation.
|
||||
// As the same classes
|
||||
// must be available in multiple class loaders,
|
||||
// it is very likely that multiple JCL jars are present.
|
||||
// The most likely fix for this
|
||||
// problem is to remove the extra JCL jars from the
|
||||
// ClassLoader hierarchy.
|
||||
//
|
||||
if (isDiagnosticsEnabled()) {
|
||||
logDiagnostic("Factory class " + logFactoryClass.getName() +
|
||||
" loaded from classloader " + objectId(logFactoryClass.getClassLoader()) +
|
||||
" does not extend '" + LogFactory.class.getName() +
|
||||
"' as loaded by this classloader.");
|
||||
logHierarchy("[BAD CL TREE] ", classLoader);
|
||||
}
|
||||
} else //
|
||||
// This indicates a problem with the ClassLoader tree.
|
||||
// An incompatible ClassLoader was used to load the
|
||||
// implementation.
|
||||
// As the same classes
|
||||
// must be available in multiple class loaders,
|
||||
// it is very likely that multiple JCL jars are present.
|
||||
// The most likely fix for this
|
||||
// problem is to remove the extra JCL jars from the
|
||||
// ClassLoader hierarchy.
|
||||
//
|
||||
if (isDiagnosticsEnabled()) {
|
||||
logDiagnostic("Factory class " + logFactoryClass.getName() +
|
||||
" loaded from classloader " + objectId(logFactoryClass.getClassLoader()) +
|
||||
" does not extend '" + LogFactory.class.getName() +
|
||||
"' as loaded by this classloader.");
|
||||
logHierarchy("[BAD CL TREE] ", classLoader);
|
||||
}
|
||||
|
||||
return (LogFactory) logFactoryClass.getConstructor().newInstance();
|
||||
return logFactoryClass.getConstructor().newInstance();
|
||||
|
||||
} catch (final ClassNotFoundException ex) {
|
||||
if (classLoader == thisClassLoaderRef.get()) {
|
||||
@@ -426,7 +424,7 @@ public abstract class LogFactory {
|
||||
" - trying the classloader associated with this LogFactory.");
|
||||
}
|
||||
logFactoryClass = Class.forName(factoryClass);
|
||||
return (LogFactory) logFactoryClass.newInstance();
|
||||
return logFactoryClass.newInstance();
|
||||
} catch (final Exception e) {
|
||||
// Check to see if we've got a bad configuration
|
||||
if (isDiagnosticsEnabled()) {
|
||||
@@ -675,13 +673,11 @@ public abstract class LogFactory {
|
||||
propsUrl = url;
|
||||
props = newProps;
|
||||
priority = newPriority;
|
||||
} else {
|
||||
if (isDiagnosticsEnabled()) {
|
||||
logDiagnostic("[LOOKUP] Properties file at '" + url + "'" +
|
||||
" with priority " + newPriority +
|
||||
" does not override file at '" + propsUrl + "'" +
|
||||
" with priority " + priority);
|
||||
}
|
||||
} else if (isDiagnosticsEnabled()) {
|
||||
logDiagnostic("[LOOKUP] Properties file at '" + url + "'" +
|
||||
" with priority " + newPriority +
|
||||
" does not override file at '" + propsUrl + "'" +
|
||||
" with priority " + priority);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -743,12 +739,7 @@ public abstract class LogFactory {
|
||||
*/
|
||||
private static ClassLoader getContextClassLoaderInternal() throws LogConfigurationException {
|
||||
return (ClassLoader)AccessController.doPrivileged(
|
||||
new PrivilegedAction() {
|
||||
@Override
|
||||
public Object run() {
|
||||
return directGetContextClassLoader();
|
||||
}
|
||||
});
|
||||
(PrivilegedAction) LogFactory::directGetContextClassLoader);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -817,7 +808,7 @@ public abstract class LogFactory {
|
||||
final String useTCCLStr = props.getProperty(TCCL_KEY);
|
||||
// The Boolean.valueOf(useTCCLStr).booleanValue() formulation
|
||||
// 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
|
||||
// LogFactory or Log classes, just use the class that loaded
|
||||
// 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);
|
||||
}
|
||||
factory = newFactory(factoryClass, baseClassLoader, contextClassLoader);
|
||||
} else {
|
||||
if (isDiagnosticsEnabled()) {
|
||||
logDiagnostic("[LOOKUP] No system property [" + FACTORY_PROPERTY + "] defined.");
|
||||
}
|
||||
} else if (isDiagnosticsEnabled()) {
|
||||
logDiagnostic("[LOOKUP] No system property [" + FACTORY_PROPERTY + "] defined.");
|
||||
}
|
||||
} catch (final SecurityException e) {
|
||||
if (isDiagnosticsEnabled()) {
|
||||
@@ -938,10 +927,8 @@ public abstract class LogFactory {
|
||||
logDiagnostic("[LOOKUP] Properties file has no entry specifying LogFactory subclass.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (isDiagnosticsEnabled()) {
|
||||
logDiagnostic("[LOOKUP] No properties file available to determine" + " LogFactory subclass from..");
|
||||
}
|
||||
} else if (isDiagnosticsEnabled()) {
|
||||
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) {
|
||||
final PrivilegedAction action =
|
||||
new PrivilegedAction() {
|
||||
@Override
|
||||
public Object run() {
|
||||
InputStream stream = null;
|
||||
() -> {
|
||||
InputStream stream = null;
|
||||
try {
|
||||
// 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 {
|
||||
// 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;
|
||||
}
|
||||
stream.close();
|
||||
} catch (final IOException e) {
|
||||
// ignore exception; this should not happen
|
||||
if (isDiagnosticsEnabled()) {
|
||||
logDiagnostic("Unable to read 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);
|
||||
}
|
||||
}
|
||||
logDiagnostic("Unable to close stream for URL " + url);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
return (Properties) AccessController.doPrivileged(action);
|
||||
}
|
||||
|
||||
@@ -1068,14 +1052,11 @@ public abstract class LogFactory {
|
||||
*/
|
||||
private static InputStream getResourceAsStream(final ClassLoader loader, final String name) {
|
||||
return (InputStream)AccessController.doPrivileged(
|
||||
new PrivilegedAction() {
|
||||
@Override
|
||||
public Object run() {
|
||||
if (loader != null) {
|
||||
return loader.getResourceAsStream(name);
|
||||
}
|
||||
return ClassLoader.getSystemResourceAsStream(name);
|
||||
(PrivilegedAction) () -> {
|
||||
if (loader != null) {
|
||||
return loader.getResourceAsStream(name);
|
||||
}
|
||||
return ClassLoader.getSystemResourceAsStream(name);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1094,28 +1075,25 @@ public abstract class LogFactory {
|
||||
*/
|
||||
private static Enumeration getResources(final ClassLoader loader, final String name) {
|
||||
final PrivilegedAction action =
|
||||
new PrivilegedAction() {
|
||||
@Override
|
||||
public Object run() {
|
||||
try {
|
||||
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;
|
||||
}
|
||||
() -> {
|
||||
try {
|
||||
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;
|
||||
}
|
||||
};
|
||||
final Object result = AccessController.doPrivileged(action);
|
||||
return (Enumeration) result;
|
||||
}
|
||||
@@ -1134,12 +1112,7 @@ public abstract class LogFactory {
|
||||
private static String getSystemProperty(final String key, final String def)
|
||||
throws SecurityException {
|
||||
return (String) AccessController.doPrivileged(
|
||||
new PrivilegedAction() {
|
||||
@Override
|
||||
public Object run() {
|
||||
return System.getProperty(key, def);
|
||||
}
|
||||
});
|
||||
(PrivilegedAction) () -> System.getProperty(key, def));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1475,12 +1448,7 @@ public abstract class LogFactory {
|
||||
// method will propagate out of this method; in particular a
|
||||
// ClassCastException can be thrown.
|
||||
final Object result = AccessController.doPrivileged(
|
||||
new PrivilegedAction() {
|
||||
@Override
|
||||
public Object run() {
|
||||
return createFactory(factoryClass, classLoader);
|
||||
}
|
||||
});
|
||||
(PrivilegedAction) () -> createFactory(factoryClass, classLoader));
|
||||
|
||||
if (result instanceof LogConfigurationException) {
|
||||
final LogConfigurationException ex = (LogConfigurationException) result;
|
||||
|
||||
@@ -72,7 +72,7 @@ public class LogSource {
|
||||
/**
|
||||
* 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
|
||||
|
||||
|
||||
@@ -236,16 +236,13 @@ public class SimpleLog implements Log, Serializable {
|
||||
|
||||
private static InputStream getResourceAsStream(final String name) {
|
||||
return (InputStream)AccessController.doPrivileged(
|
||||
new PrivilegedAction() {
|
||||
@Override
|
||||
public Object run() {
|
||||
final ClassLoader threadCL = getContextClassLoader();
|
||||
(PrivilegedAction) () -> {
|
||||
final ClassLoader threadCL = getContextClassLoader();
|
||||
|
||||
if (threadCL != null) {
|
||||
return threadCL.getResourceAsStream(name);
|
||||
}
|
||||
return ClassLoader.getSystemResourceAsStream(name);
|
||||
if (threadCL != null) {
|
||||
return threadCL.getResourceAsStream(name);
|
||||
}
|
||||
return ClassLoader.getSystemResourceAsStream(name);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public final class GarbageCollectionHelper implements Closeable, Runnable {
|
||||
// Allocate data to help suggest a GC
|
||||
try {
|
||||
// 1mb of heap
|
||||
byte[] buf = new byte[1024 * 1024];
|
||||
final byte[] buf = new byte[1024 * 1024];
|
||||
SINK.write(buf);
|
||||
} catch (final IOException ignored) {
|
||||
}
|
||||
@@ -49,15 +49,15 @@ public final class GarbageCollectionHelper implements Closeable, Runnable {
|
||||
}
|
||||
private static final OutputStream SINK = new OutputStream() {
|
||||
@Override
|
||||
public void write(byte[] b) {
|
||||
public void write(final byte[] b) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b, int off, int len) {
|
||||
public void write(final byte[] b, final int off, final int len) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) {
|
||||
public void write(final int b) {
|
||||
}
|
||||
};
|
||||
private final AtomicBoolean running = new AtomicBoolean();
|
||||
|
||||
@@ -37,7 +37,7 @@ public class LogFactoryWeakReferenceTestCase extends TestCase {
|
||||
// reflection hacks to obtain the weak reference
|
||||
Field field = logFactoryClass.getDeclaredField("thisClassLoaderRef");
|
||||
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
|
||||
assertSame(loader, thisClassLoaderRef.get());
|
||||
@@ -48,10 +48,10 @@ public class LogFactoryWeakReferenceTestCase extends TestCase {
|
||||
loader.close();
|
||||
loader = null;
|
||||
|
||||
GarbageCollectionHelper gcHelper = new GarbageCollectionHelper();
|
||||
final GarbageCollectionHelper gcHelper = new GarbageCollectionHelper();
|
||||
gcHelper.run();
|
||||
try {
|
||||
long start = System.currentTimeMillis();
|
||||
final long start = System.currentTimeMillis();
|
||||
while (thisClassLoaderRef.get() != null) {
|
||||
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.");
|
||||
|
||||
@@ -48,7 +48,7 @@ import java.util.Map;
|
||||
|
||||
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
|
||||
|
||||
@@ -75,12 +75,12 @@ public class WeakHashtableTestCase extends TestCase {
|
||||
super.setUp();
|
||||
weakHashtable = new WeakHashtable();
|
||||
|
||||
keyOne = new Long(1);
|
||||
keyTwo = new Long(2);
|
||||
keyThree = new Long(3);
|
||||
valueOne = new Long(100);
|
||||
valueTwo = new Long(200);
|
||||
valueThree = new Long(300);
|
||||
keyOne = Long.valueOf(1);
|
||||
keyTwo = Long.valueOf(2);
|
||||
keyThree = Long.valueOf(3);
|
||||
valueOne = Long.valueOf(100);
|
||||
valueTwo = Long.valueOf(200);
|
||||
valueThree = Long.valueOf(300);
|
||||
|
||||
weakHashtable.put(keyOne, valueOne);
|
||||
weakHashtable.put(keyTwo, valueTwo);
|
||||
@@ -89,35 +89,35 @@ public class WeakHashtableTestCase extends TestCase {
|
||||
|
||||
/** Tests public boolean contains(Object value) */
|
||||
public void testContains() throws Exception {
|
||||
assertFalse(weakHashtable.contains(new Long(1)));
|
||||
assertFalse(weakHashtable.contains(new Long(2)));
|
||||
assertFalse(weakHashtable.contains(new Long(3)));
|
||||
assertTrue(weakHashtable.contains(new Long(100)));
|
||||
assertTrue(weakHashtable.contains(new Long(200)));
|
||||
assertTrue(weakHashtable.contains(new Long(300)));
|
||||
assertFalse(weakHashtable.contains(new Long(400)));
|
||||
assertFalse(weakHashtable.contains(Long.valueOf(1)));
|
||||
assertFalse(weakHashtable.contains(Long.valueOf(2)));
|
||||
assertFalse(weakHashtable.contains(Long.valueOf(3)));
|
||||
assertTrue(weakHashtable.contains(Long.valueOf(100)));
|
||||
assertTrue(weakHashtable.contains(Long.valueOf(200)));
|
||||
assertTrue(weakHashtable.contains(Long.valueOf(300)));
|
||||
assertFalse(weakHashtable.contains(Long.valueOf(400)));
|
||||
}
|
||||
|
||||
/** Tests public boolean containsKey(Object key) */
|
||||
public void testContainsKey() throws Exception {
|
||||
assertTrue(weakHashtable.containsKey(new Long(1)));
|
||||
assertTrue(weakHashtable.containsKey(new Long(2)));
|
||||
assertTrue(weakHashtable.containsKey(new Long(3)));
|
||||
assertFalse(weakHashtable.containsKey(new Long(100)));
|
||||
assertFalse(weakHashtable.containsKey(new Long(200)));
|
||||
assertFalse(weakHashtable.containsKey(new Long(300)));
|
||||
assertFalse(weakHashtable.containsKey(new Long(400)));
|
||||
assertTrue(weakHashtable.containsKey(Long.valueOf(1)));
|
||||
assertTrue(weakHashtable.containsKey(Long.valueOf(2)));
|
||||
assertTrue(weakHashtable.containsKey(Long.valueOf(3)));
|
||||
assertFalse(weakHashtable.containsKey(Long.valueOf(100)));
|
||||
assertFalse(weakHashtable.containsKey(Long.valueOf(200)));
|
||||
assertFalse(weakHashtable.containsKey(Long.valueOf(300)));
|
||||
assertFalse(weakHashtable.containsKey(Long.valueOf(400)));
|
||||
}
|
||||
|
||||
/** Tests public boolean containsValue(Object value) */
|
||||
public void testContainsValue() throws Exception {
|
||||
assertFalse(weakHashtable.containsValue(new Long(1)));
|
||||
assertFalse(weakHashtable.containsValue(new Long(2)));
|
||||
assertFalse(weakHashtable.containsValue(new Long(3)));
|
||||
assertTrue(weakHashtable.containsValue(new Long(100)));
|
||||
assertTrue(weakHashtable.containsValue(new Long(200)));
|
||||
assertTrue(weakHashtable.containsValue(new Long(300)));
|
||||
assertFalse(weakHashtable.containsValue(new Long(400)));
|
||||
assertFalse(weakHashtable.containsValue(Long.valueOf(1)));
|
||||
assertFalse(weakHashtable.containsValue(Long.valueOf(2)));
|
||||
assertFalse(weakHashtable.containsValue(Long.valueOf(3)));
|
||||
assertTrue(weakHashtable.containsValue(Long.valueOf(100)));
|
||||
assertTrue(weakHashtable.containsValue(Long.valueOf(200)));
|
||||
assertTrue(weakHashtable.containsValue(Long.valueOf(300)));
|
||||
assertFalse(weakHashtable.containsValue(Long.valueOf(400)));
|
||||
}
|
||||
|
||||
/** Tests public Enumeration elements() */
|
||||
@@ -155,7 +155,7 @@ public class WeakHashtableTestCase extends TestCase {
|
||||
assertEquals(valueOne, weakHashtable.get(keyOne));
|
||||
assertEquals(valueTwo, weakHashtable.get(keyTwo));
|
||||
assertEquals(valueThree, weakHashtable.get(keyThree));
|
||||
assertNull(weakHashtable.get(new Long(50)));
|
||||
assertNull(weakHashtable.get(Long.valueOf(50)));
|
||||
}
|
||||
|
||||
/** Tests public Enumeration keys() */
|
||||
@@ -208,10 +208,10 @@ public class WeakHashtableTestCase extends TestCase {
|
||||
|
||||
/** Tests public Object put(Object key, Object value) */
|
||||
public void testPut() throws Exception {
|
||||
final Long anotherKey = new Long(2004);
|
||||
weakHashtable.put(anotherKey, new Long(1066));
|
||||
final Long anotherKey = Long.valueOf(2004);
|
||||
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
|
||||
Exception caught = null;
|
||||
@@ -235,11 +235,11 @@ public class WeakHashtableTestCase extends TestCase {
|
||||
/** Tests public void putAll(Map t) */
|
||||
public void testPutAll() throws Exception {
|
||||
final Map newValues = new HashMap();
|
||||
final Long newKey = new Long(1066);
|
||||
final Long newValue = new Long(1415);
|
||||
final Long newKey = Long.valueOf(1066);
|
||||
final Long newValue = Long.valueOf(1415);
|
||||
newValues.put(newKey, newValue);
|
||||
final Long anotherNewKey = new Long(1645);
|
||||
final Long anotherNewValue = new Long(1815);
|
||||
final Long anotherNewKey = Long.valueOf(1645);
|
||||
final Long anotherNewValue = Long.valueOf(1815);
|
||||
newValues.put(anotherNewKey, anotherNewValue);
|
||||
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
|
||||
*/
|
||||
public void xxxIgnoretestRelease() throws Exception {
|
||||
assertNotNull(weakHashtable.get(new Long(1)));
|
||||
assertNotNull(weakHashtable.get(Long.valueOf(1)));
|
||||
final ReferenceQueue testQueue = new ReferenceQueue();
|
||||
final WeakReference weakKeyOne = new WeakReference(keyOne, testQueue);
|
||||
|
||||
@@ -292,7 +292,7 @@ public class WeakHashtableTestCase extends TestCase {
|
||||
fail("Max iterations reached before resource released.");
|
||||
}
|
||||
|
||||
if (weakHashtable.get(new Long(1)) == null) {
|
||||
if (weakHashtable.get(Long.valueOf(1)) == null) {
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
@@ -67,14 +67,14 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
|
||||
final ClassLoader srcCL = CustomConfigAPITestCase.class.getClassLoader();
|
||||
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 Object[] args = new Object[4];
|
||||
args[0] = className;
|
||||
args[1] = classData;
|
||||
args[2] = new Integer(0);
|
||||
args[3] = new Integer(classData.length);
|
||||
args[2] = Integer.valueOf(0);
|
||||
args[3] = Integer.valueOf(classData.length);
|
||||
m.setAccessible(true);
|
||||
m.invoke(targetCL, args);
|
||||
} catch (final Exception e) {
|
||||
|
||||
@@ -41,7 +41,7 @@ public class GeneralTestCase extends TestCase {
|
||||
contextLoader.getClass().getName(),
|
||||
PathableClassLoader.class.getName());
|
||||
|
||||
final URL[] noUrls = new URL[0];
|
||||
final URL[] noUrls = {};
|
||||
Thread.currentThread().setContextClassLoader(new URLClassLoader(noUrls));
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
|
||||
public class DummyLogFactory extends LogFactory {
|
||||
@Override
|
||||
public Object getAttribute(String name) {
|
||||
public Object getAttribute(final String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -32,12 +32,12 @@ public class DummyLogFactory extends LogFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Log getInstance(Class clazz) throws LogConfigurationException {
|
||||
public Log getInstance(final Class clazz) throws LogConfigurationException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Log getInstance(String name) throws LogConfigurationException {
|
||||
public Log getInstance(final String name) throws LogConfigurationException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -47,12 +47,12 @@ public class DummyLogFactory extends LogFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAttribute(String name) {
|
||||
public void removeAttribute(final String name) {
|
||||
// empty
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(String name, Object value) {
|
||||
public void setAttribute(final String name, final Object value) {
|
||||
// empty
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user