summaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authormwebster <mwebster>2006-08-01 13:09:06 +0000
committermwebster <mwebster>2006-08-01 13:09:06 +0000
commita89eac7f94cbea34f2ca76e49a1c42a594194080 (patch)
tree1c2cbc2179147a120c61a4e28a9093455f5597e5 /weaver
parentf4289cd1511ef1977fecd10cb1949c78dfbb9e9c (diff)
downloadaspectj-a89eac7f94cbea34f2ca76e49a1c42a594194080.tar.gz
aspectj-a89eac7f94cbea34f2ca76e49a1c42a594194080.zip
Bug 150487 "Tracing and Logging Framework" (lazy initialize SimpleDateFormat to prevent recursion in JDK 1.4 LTW)
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/ExtensibleURLClassLoader.java8
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java10
-rw-r--r--weaver/src/org/aspectj/weaver/tools/AbstractTrace.java12
3 files changed, 20 insertions, 10 deletions
diff --git a/weaver/src/org/aspectj/weaver/ExtensibleURLClassLoader.java b/weaver/src/org/aspectj/weaver/ExtensibleURLClassLoader.java
index 74d68703d..e35d95eb3 100644
--- a/weaver/src/org/aspectj/weaver/ExtensibleURLClassLoader.java
+++ b/weaver/src/org/aspectj/weaver/ExtensibleURLClassLoader.java
@@ -29,7 +29,13 @@ public abstract class ExtensibleURLClassLoader extends URLClassLoader {
super(urls,parent);
// System.err.println("? ExtensibleURLClassLoader.<init>() path=" + WeavingAdaptor.makeClasspath(urls));
- classPath = new ClassPathManager(FileUtil.makeClasspath(urls),null);
+ try {
+ classPath = new ClassPathManager(FileUtil.makeClasspath(urls),null);
+ }
+ catch (ExceptionInInitializerError ex) {
+ ex.printStackTrace(System.out);
+ throw ex;
+ }
}
protected void addURL(URL url) {
diff --git a/weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java b/weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java
index 6f9025e20..5f06c0e6f 100644
--- a/weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java
+++ b/weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java
@@ -46,11 +46,7 @@ public class ClassPathManager {
private static int maxOpenArchives = -1;
private static final int MAXOPEN_DEFAULT = 1000;
- /*
- * FIXME maw Tracing ClassPathManager can cause recursion for JDK 1.4
- * LTW i.e. -Djava.system.class.loader
- */
-// private static Trace trace = TraceFactory.getTraceFactory().getTrace(ClassPathManager.class);
+ private static Trace trace = TraceFactory.getTraceFactory().getTrace(ClassPathManager.class);
static {
String openzipsString = getSystemPropertyWithoutSecurityException("org.aspectj.weaver.openarchives",Integer.toString(MAXOPEN_DEFAULT));
@@ -61,13 +57,13 @@ public class ClassPathManager {
public ClassPathManager(List classpath, IMessageHandler handler) {
-// if (trace.isTraceEnabled()) trace.enter("<init>",this,new Object[] { classpath, handler });
+ if (trace.isTraceEnabled()) trace.enter("<init>",this,new Object[] { classpath, handler });
entries = new ArrayList();
for (Iterator i = classpath.iterator(); i.hasNext();) {
String name = (String) i.next();
addPath(name, handler);
}
-// if (trace.isTraceEnabled()) trace.exit("<init>");
+ if (trace.isTraceEnabled()) trace.exit("<init>");
}
protected ClassPathManager() {};
diff --git a/weaver/src/org/aspectj/weaver/tools/AbstractTrace.java b/weaver/src/org/aspectj/weaver/tools/AbstractTrace.java
index 877fc79dd..4b421f2ae 100644
--- a/weaver/src/org/aspectj/weaver/tools/AbstractTrace.java
+++ b/weaver/src/org/aspectj/weaver/tools/AbstractTrace.java
@@ -18,7 +18,7 @@ public abstract class AbstractTrace implements Trace {
protected Class tracedClass;
- private static SimpleDateFormat time = new SimpleDateFormat("HH:mm:ss.SSS");
+ private static SimpleDateFormat timeFormat;
protected AbstractTrace (Class clazz) {
this.tracedClass = clazz;
@@ -94,7 +94,7 @@ public abstract class AbstractTrace implements Trace {
protected String formatMessage(String kind, String className, String methodName, Object thiz, Object[] args) {
StringBuffer message = new StringBuffer();
Date now = new Date();
- message.append(time.format(now)).append(" ");
+ message.append(formatDate(now)).append(" ");
message.append(Thread.currentThread().getName()).append(" ");
message.append(kind).append(" ");
message.append(className);
@@ -103,6 +103,14 @@ public abstract class AbstractTrace implements Trace {
if (args != null) message.append(" ").append(formatArgs(args));
return message.toString();
}
+
+ private static String formatDate (Date date) {
+ if (timeFormat == null) {
+ timeFormat = new SimpleDateFormat("HH:mm:ss.SSS");
+ }
+
+ return timeFormat.format(date);
+ }
/**
* Format objects safely avoiding toString which can cause recursion,