Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/logging/impl
In directory sc8-pr-cvs1:/tmp/cvs-serv27688
Modified Files:
Jdk14Logger.java
Log Message:
Removed final bits of JDK1.3 specific code
Index: Jdk14Logger.java
===================================================================
RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/logging/impl/Jdk14Logger.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Jdk14Logger.java 10 Sep 2003 22:21:04 -0000 1.4
--- Jdk14Logger.java 10 Sep 2003 23:05:40 -0000 1.5
***************
*** 63,66 ****
--- 63,67 ----
import java.lang.reflect.Method;
+ import java.lang.reflect.InvocationTargetException;
import org.logicalcobwebs.logging.Log;
***************
*** 98,101 ****
--- 99,106 ----
final Class levelClass = Class.forName("java.util.logging.Level");
isLoggableMethod = loggerClass.getMethod("isLoggable", new Class[] {levelClass});
+ getStackTraceMethod = Throwable.class.getMethod("getStackTrace", null);
+ final Class stackTraceClass = Class.forName("java.lang.StackTraceElement");
+ getClassNameMethod = stackTraceClass.getMethod("getClassName", null);
+ getMethodNameMethod = stackTraceClass.getMethod("getMethodName", null);
levelFINEST = levelClass.getField("FINEST").get(null);
levelFINE = levelClass.getField("FINE").get(null);
***************
*** 121,124 ****
--- 126,132 ----
private Method logpExMethod = null;
private Method isLoggableMethod = null;
+ private Method getStackTraceMethod = null;
+ private Method getClassNameMethod = null;
+ private Method getMethodNameMethod = null;
private Object levelFINEST = null;
***************
*** 139,150 ****
// Hack (?) to get the stack trace.
Throwable dummyException = new Throwable ();
- StackTraceElement locations[] = dummyException.getStackTrace ();
- // Caller will be the third element
String cname = "unknown";
String method = "unknown";
! if (locations != null && locations.length > 2) {
! StackTraceElement caller = locations[2];
! cname = caller.getClassName ();
! method = caller.getMethodName ();
}
--- 147,166 ----
// Hack (?) to get the stack trace.
Throwable dummyException = new Throwable ();
String cname = "unknown";
String method = "unknown";
! // Use reflection instead of JDK1.4 code.
! try {
! Object locations[] = (Object[]) getStackTraceMethod.invoke(dummyException, null);
! // Caller will be the third element
! if (locations != null && locations.length > 2) {
! cname = (String) getClassNameMethod.invoke(locations[2], null);
! method = (String) getMethodNameMethod.invoke(locations[2], null);
! }
! } catch (IllegalAccessException e) {
! e.printStackTrace();
! } catch (IllegalArgumentException e) {
! e.printStackTrace();
! } catch (InvocationTargetException e) {
! e.printStackTrace();
}
|