1
0

Ensure an ExceptionInInitializerError occurs when trying to create an instance

of these classes in pre-1.4 JVMs. Without this, an InvocationTargetException
could be thrown when calling the constructor but that could also be caused
by a number of other reasons which we don't want to ignore.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@179529 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Simon Kitching
2005-06-02 06:31:52 +00:00
parent df0d0ed341
commit 5c06195efb
2 changed files with 15 additions and 0 deletions

View File

@@ -57,6 +57,14 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
private boolean classAndMethodFound = false;
/**
* This member variable simply ensures that any attempt to initialise
* this class in a pre-1.4 JVM will result in an ExceptionInInitializerError.
* It must not be private, as an optimising compiler could detect that it
* is not used and optimise it away.
*/
protected static final Level dummyLevel = Level.FINE;
// ----------------------------------------------------------- Constructors

View File

@@ -38,6 +38,13 @@ import org.apache.commons.logging.Log;
public class Jdk14Logger implements Log, Serializable {
/**
* This member variable simply ensures that any attempt to initialise
* this class in a pre-1.4 JVM will result in an ExceptionInInitializerError.
* It must not be private, as an optimising compiler could detect that it
* is not used and optimise it away.
*/
protected static final Level dummyLevel = Level.FINE;
// ----------------------------------------------------------- Constructors