1
0

Format: "catch(" -> "catch ("

This commit is contained in:
Gary Gregory
2023-04-18 10:56:16 -04:00
parent f87a49c957
commit 869eaa18df
14 changed files with 28 additions and 28 deletions

View File

@@ -83,7 +83,7 @@ public class Log4JLogger implements Log, Serializable {
Priority _traceLevel; Priority _traceLevel;
try { try {
_traceLevel = (Priority) Level.class.getDeclaredField("TRACE").get(null); _traceLevel = (Priority) Level.class.getDeclaredField("TRACE").get(null);
} catch(final Exception ex) { } catch (final Exception ex) {
// ok, trace not available // ok, trace not available
_traceLevel = Level.DEBUG; _traceLevel = Level.DEBUG;
} }

View File

@@ -102,19 +102,19 @@ public class ServletContextCleaner implements ServletContextListener {
final Method releaseMethod = logFactoryClass.getMethod("release", RELEASE_SIGNATURE); final Method releaseMethod = logFactoryClass.getMethod("release", RELEASE_SIGNATURE);
releaseMethod.invoke(null, params); releaseMethod.invoke(null, params);
loader = logFactoryClass.getClassLoader().getParent(); loader = logFactoryClass.getClassLoader().getParent();
} catch(final ClassNotFoundException ex) { } catch (final ClassNotFoundException ex) {
// Neither the current classloader nor any of its ancestors could find // Neither the current classloader nor any of its ancestors could find
// the LogFactory class, so we can stop now. // the LogFactory class, so we can stop now.
loader = null; loader = null;
} catch(final NoSuchMethodException ex) { } catch (final NoSuchMethodException ex) {
// This is not expected; every version of JCL has this method // This is not expected; every version of JCL has this method
System.err.println("LogFactory instance found which does not support release method!"); System.err.println("LogFactory instance found which does not support release method!");
loader = null; loader = null;
} catch(final IllegalAccessException ex) { } catch (final IllegalAccessException ex) {
// This is not expected; every ancestor class should be accessible // This is not expected; every ancestor class should be accessible
System.err.println("LogFactory instance found which is not accessable!"); System.err.println("LogFactory instance found which is not accessable!");
loader = null; loader = null;
} catch(final InvocationTargetException ex) { } catch (final InvocationTargetException ex) {
// This is not expected // This is not expected
System.err.println("LogFactory instance release method failed!"); System.err.println("LogFactory instance release method failed!");
loader = null; loader = null;

View File

@@ -182,7 +182,7 @@ public class SimpleLog implements Log, Serializable {
dateTimeFormat); dateTimeFormat);
try { try {
dateFormatter = new SimpleDateFormat(dateTimeFormat); dateFormatter = new SimpleDateFormat(dateTimeFormat);
} catch(final IllegalArgumentException e) { } catch (final IllegalArgumentException e) {
// If the format pattern is invalid - use the default format // If the format pattern is invalid - use the default format
dateTimeFormat = DEFAULT_DATE_TIME_FORMAT; dateTimeFormat = DEFAULT_DATE_TIME_FORMAT;
dateFormatter = new SimpleDateFormat(dateTimeFormat); dateFormatter = new SimpleDateFormat(dateTimeFormat);

View File

@@ -141,7 +141,7 @@ public class LoadTestCase extends TestCase{
setAllowFlawedContext(cls, "false"); setAllowFlawedContext(cls, "false");
execute(cls); execute(cls);
fail("Logging config succeeded when context classloader was null!"); fail("Logging config succeeded when context classloader was null!");
} catch(final LogConfigurationException ex) { } catch (final LogConfigurationException ex) {
// expected; the boot classloader doesn't *have* JCL available // expected; the boot classloader doesn't *have* JCL available
} }
@@ -166,7 +166,7 @@ public class LoadTestCase extends TestCase{
execute(cls); execute(cls);
fail("Error: somehow downcast a Logger loaded via system classloader" fail("Error: somehow downcast a Logger loaded via system classloader"
+ " to the Log interface loaded via a custom classloader"); + " to the Log interface loaded via a custom classloader");
} catch(final LogConfigurationException ex) { } catch (final LogConfigurationException ex) {
// expected // expected
} }
} }

View File

@@ -212,7 +212,7 @@ public class PathableClassLoader extends URLClassLoader {
final URL libUrl = new File(filename).toURL(); final URL libUrl = new File(filename).toURL();
addURL(libUrl); addURL(libUrl);
return; return;
} catch(final java.net.MalformedURLException e) { } catch (final java.net.MalformedURLException e) {
throw new UnknownError( throw new UnknownError(
"Invalid file [" + filename + "] for logical lib [" + logicalLib + "]"); "Invalid file [" + filename + "] for logical lib [" + logicalLib + "]");
} }
@@ -322,7 +322,7 @@ public class PathableClassLoader extends URLClassLoader {
resolveClass(clazz); resolveClass(clazz);
} }
return clazz; return clazz;
} catch(final ClassNotFoundException e) { } catch (final ClassNotFoundException e) {
return super.loadClass(name, resolve); return super.loadClass(name, resolve);
} }
} }
@@ -413,7 +413,7 @@ public class PathableClassLoader extends URLClassLoader {
if (local != null) { if (local != null) {
try { try {
return local.openStream(); return local.openStream();
} catch(final IOException e) { } catch (final IOException e) {
// TODO: check if this is right or whether we should // TODO: check if this is right or whether we should
// fall back to trying parent. The javadoc doesn't say... // fall back to trying parent. The javadoc doesn't say...
return null; return null;

View File

@@ -135,7 +135,7 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
targetCL.loadClass(className); targetCL.loadClass(className);
// fail("Class already in target classloader"); // fail("Class already in target classloader");
return; return;
} catch(final ClassNotFoundException ex) { } catch (final ClassNotFoundException ex) {
// ok, go ahead and load it // ok, go ahead and load it
} }
@@ -153,7 +153,7 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
args[3] = new Integer(classData.length); args[3] = new Integer(classData.length);
m.setAccessible(true); m.setAccessible(true);
m.invoke(targetCL, args); m.invoke(targetCL, args);
} catch(final Exception e) { } catch (final Exception e) {
e.printStackTrace(); e.printStackTrace();
fail("Unable to load class " + className); fail("Unable to load class " + className);
} }

View File

@@ -179,7 +179,7 @@ public class ChildFirstTestCase extends TestCase {
final Class noSuchClass = contextLoader.loadClass("no.such.class"); final Class noSuchClass = contextLoader.loadClass("no.such.class");
fail("Class no.such.class is unexpectedly available"); fail("Class no.such.class is unexpectedly available");
assertNotNull(noSuchClass); // silence warning about unused var assertNotNull(noSuchClass); // silence warning about unused var
} catch(final ClassNotFoundException ex) { } catch (final ClassNotFoundException ex) {
// ok // ok
} }

View File

@@ -177,7 +177,7 @@ public class ParentFirstTestCase extends TestCase {
final Class noSuchClass = contextLoader.loadClass("no.such.class"); final Class noSuchClass = contextLoader.loadClass("no.such.class");
fail("Class no.such.class is unexpectedly available"); fail("Class no.such.class is unexpectedly available");
assertNotNull(noSuchClass); // silence warning about unused var assertNotNull(noSuchClass); // silence warning about unused var
} catch(final ClassNotFoundException ex) { } catch (final ClassNotFoundException ex) {
// ok // ok
} }

View File

@@ -128,7 +128,7 @@ public class SecurityAllowedTestCase extends TestCase
// we better compare that we have no security exception during the call to log // we better compare that we have no security exception during the call to log
// IBM JVM tries to load bundles during the invoke call, which increase the count // IBM JVM tries to load bundles during the invoke call, which increase the count
assertEquals("Untrusted code count", untrustedCodeCount, mySecurityManager.getUntrustedCodeCount()); assertEquals("Untrusted code count", untrustedCodeCount, mySecurityManager.getUntrustedCodeCount());
} catch(final Throwable t) { } catch (final Throwable t) {
// Restore original security manager so output can be generated; the // Restore original security manager so output can be generated; the
// PrintWriter constructor tries to read the line.separator // PrintWriter constructor tries to read the line.separator
// system property. // system property.

View File

@@ -131,7 +131,7 @@ public class SecurityForbiddenTestCase extends TestCase
CustomHashtable.class.getName(), ftClassName); CustomHashtable.class.getName(), ftClassName);
assertEquals(0, mySecurityManager.getUntrustedCodeCount()); assertEquals(0, mySecurityManager.getUntrustedCodeCount());
} catch(final Throwable t) { } catch (final Throwable t) {
// Restore original security manager so output can be generated; the // Restore original security manager so output can be generated; the
// PrintWriter constructor tries to read the line.separator // PrintWriter constructor tries to read the line.separator
// system property. // system property.
@@ -164,7 +164,7 @@ public class SecurityForbiddenTestCase extends TestCase
System.setSecurityManager(oldSecMgr); System.setSecurityManager(oldSecMgr);
assertEquals(0, mySecurityManager.getUntrustedCodeCount()); assertEquals(0, mySecurityManager.getUntrustedCodeCount());
} catch(final Throwable t) { } catch (final Throwable t) {
// Restore original security manager so output can be generated; the // Restore original security manager so output can be generated; the
// PrintWriter constructor tries to read the line.separator // PrintWriter constructor tries to read the line.separator
// system property. // system property.

View File

@@ -122,7 +122,7 @@ public class TcclDisabledTestCase extends TestCase {
final Class clazz = thisClassLoader.loadClass(MY_LOG_IMPL); final Class clazz = thisClassLoader.loadClass(MY_LOG_IMPL);
fail("Unexpectedly able to load MyLog via test class classloader"); fail("Unexpectedly able to load MyLog via test class classloader");
assertNotNull(clazz); // silence warnings about unused var assertNotNull(clazz); // silence warnings about unused var
} catch(final ClassNotFoundException ex) { } catch (final ClassNotFoundException ex) {
// ok, expected // ok, expected
} }
@@ -130,7 +130,7 @@ public class TcclDisabledTestCase extends TestCase {
try { try {
final Class clazz = tcclLoader.loadClass(MY_LOG_IMPL); final Class clazz = tcclLoader.loadClass(MY_LOG_IMPL);
assertNotNull(clazz); assertNotNull(clazz);
} catch(final ClassNotFoundException ex) { } catch (final ClassNotFoundException ex) {
fail("Unexpectedly unable to load MyLog via tccl classloader"); fail("Unexpectedly unable to load MyLog via tccl classloader");
} }
} }
@@ -153,7 +153,7 @@ public class TcclDisabledTestCase extends TestCase {
fail("Unexpectedly succeeded in loading a custom Log class" fail("Unexpectedly succeeded in loading a custom Log class"
+ " that is only accessable via the tccl."); + " that is only accessable via the tccl.");
assertNotNull(log); // silence compiler warning about unused var assertNotNull(log); // silence compiler warning about unused var
} catch(final LogConfigurationException ex) { } catch (final LogConfigurationException ex) {
// ok, expected // ok, expected
final int index = ex.getMessage().indexOf(MY_LOG_IMPL); final int index = ex.getMessage().indexOf(MY_LOG_IMPL);
assertTrue("MyLog not found", index >= 0); assertTrue("MyLog not found", index >= 0);

View File

@@ -122,7 +122,7 @@ public class TcclEnabledTestCase extends TestCase {
final Class clazz = thisClassLoader.loadClass(MY_LOG_IMPL); final Class clazz = thisClassLoader.loadClass(MY_LOG_IMPL);
fail("Unexpectedly able to load MyLog via test class classloader"); fail("Unexpectedly able to load MyLog via test class classloader");
assertNotNull(clazz); // silence warnings about unused var assertNotNull(clazz); // silence warnings about unused var
} catch(final ClassNotFoundException ex) { } catch (final ClassNotFoundException ex) {
// ok, expected // ok, expected
} }
@@ -130,7 +130,7 @@ public class TcclEnabledTestCase extends TestCase {
try { try {
final Class clazz = tcclLoader.loadClass(MY_LOG_IMPL); final Class clazz = tcclLoader.loadClass(MY_LOG_IMPL);
assertNotNull(clazz); assertNotNull(clazz);
} catch(final ClassNotFoundException ex) { } catch (final ClassNotFoundException ex) {
fail("Unexpectedly unable to load MyLog via tccl classloader"); fail("Unexpectedly unable to load MyLog via tccl classloader");
} }
} }

View File

@@ -124,7 +124,7 @@ public class TcclDisabledTestCase extends TestCase {
final Class clazz = thisClassLoader.loadClass(MY_LOG_FACTORY_IMPL); final Class clazz = thisClassLoader.loadClass(MY_LOG_FACTORY_IMPL);
fail("Unexpectedly able to load MyLogFactoryImpl via test class classloader"); fail("Unexpectedly able to load MyLogFactoryImpl via test class classloader");
assertNotNull(clazz); // silence warning about unused var assertNotNull(clazz); // silence warning about unused var
} catch(final ClassNotFoundException ex) { } catch (final ClassNotFoundException ex) {
// ok, expected // ok, expected
} }
@@ -132,7 +132,7 @@ public class TcclDisabledTestCase extends TestCase {
try { try {
final Class clazz = tcclLoader.loadClass(MY_LOG_FACTORY_IMPL); final Class clazz = tcclLoader.loadClass(MY_LOG_FACTORY_IMPL);
assertNotNull(clazz); assertNotNull(clazz);
} catch(final ClassNotFoundException ex) { } catch (final ClassNotFoundException ex) {
fail("Unexpectedly unable to load MyLogFactoryImpl via tccl classloader"); fail("Unexpectedly unable to load MyLogFactoryImpl via tccl classloader");
} }
} }
@@ -148,7 +148,7 @@ public class TcclDisabledTestCase extends TestCase {
final LogFactory instance = LogFactory.getFactory(); final LogFactory instance = LogFactory.getFactory();
fail("Unexpectedly succeeded in loading custom factory, though TCCL disabled."); fail("Unexpectedly succeeded in loading custom factory, though TCCL disabled.");
assertNotNull(instance); // silence warning about unused var assertNotNull(instance); // silence warning about unused var
} catch(final org.apache.commons.logging.LogConfigurationException ex) { } catch (final org.apache.commons.logging.LogConfigurationException ex) {
// ok, custom MyLogFactoryImpl as specified in props_disable_tccl // ok, custom MyLogFactoryImpl as specified in props_disable_tccl
// could not be found. // could not be found.
final int index = ex.getMessage().indexOf(MY_LOG_FACTORY_IMPL); final int index = ex.getMessage().indexOf(MY_LOG_FACTORY_IMPL);

View File

@@ -119,7 +119,7 @@ public class TcclEnabledTestCase extends TestCase {
"org.apache.commons.logging.tccl.custom.MyLogFactoryImpl"); "org.apache.commons.logging.tccl.custom.MyLogFactoryImpl");
fail("Unexpectedly able to load MyLogFactoryImpl via test class classloader"); fail("Unexpectedly able to load MyLogFactoryImpl via test class classloader");
assertNotNull(clazz); // silence warning about unused var assertNotNull(clazz); // silence warning about unused var
} catch(final ClassNotFoundException ex) { } catch (final ClassNotFoundException ex) {
// ok, expected // ok, expected
} }
@@ -128,7 +128,7 @@ public class TcclEnabledTestCase extends TestCase {
final Class clazz = tcclLoader.loadClass( final Class clazz = tcclLoader.loadClass(
"org.apache.commons.logging.tccl.custom.MyLogFactoryImpl"); "org.apache.commons.logging.tccl.custom.MyLogFactoryImpl");
assertNotNull(clazz); assertNotNull(clazz);
} catch(final ClassNotFoundException ex) { } catch (final ClassNotFoundException ex) {
fail("Unexpectedly unable to load MyLogFactoryImpl via tccl classloader"); fail("Unexpectedly unable to load MyLogFactoryImpl via tccl classloader");
} }
} }