diff options
author | mwebster <mwebster> | 2006-08-01 13:09:06 +0000 |
---|---|---|
committer | mwebster <mwebster> | 2006-08-01 13:09:06 +0000 |
commit | a89eac7f94cbea34f2ca76e49a1c42a594194080 (patch) | |
tree | 1c2cbc2179147a120c61a4e28a9093455f5597e5 /loadtime | |
parent | f4289cd1511ef1977fecd10cb1949c78dfbb9e9c (diff) | |
download | aspectj-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 'loadtime')
-rw-r--r-- | loadtime/src/org/aspectj/weaver/loadtime/WeavingURLClassLoader.java | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/loadtime/src/org/aspectj/weaver/loadtime/WeavingURLClassLoader.java b/loadtime/src/org/aspectj/weaver/loadtime/WeavingURLClassLoader.java index 2a3d19381..0dc1506df 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/WeavingURLClassLoader.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/WeavingURLClassLoader.java @@ -43,7 +43,7 @@ public class WeavingURLClassLoader extends ExtensibleURLClassLoader implements W */ public WeavingURLClassLoader (ClassLoader parent) { this(getURLs(getClassPath()),getURLs(getAspectPath()),parent); -// System.err.println("? WeavingURLClassLoader.<init>(" + m_parent + ")"); +// System.out.println("? WeavingURLClassLoader.WeavingURLClassLoader()"); } public WeavingURLClassLoader (URL[] urls, ClassLoader parent) { @@ -53,15 +53,22 @@ public class WeavingURLClassLoader extends ExtensibleURLClassLoader implements W public WeavingURLClassLoader (URL[] classURLs, URL[] aspectURLs, ClassLoader parent) { super(classURLs,parent); -// System.err.println("? WeavingURLClassLoader.<init>() classURLs=" + classURLs.length + ", aspectURLs=" + aspectURLs.length); +// System.out.println("> WeavingURLClassLoader.WeavingURLClassLoader() classURLs=" + Arrays.asList(classURLs)); this.aspectURLs = aspectURLs; - /* If either we nor our m_parent is using an ASPECT_PATH use a new-style + /* If either we nor our parent is using an ASPECT_PATH use a new-style * adaptor */ - if (this.aspectURLs.length > 0 || parent instanceof WeavingClassLoader) { - adaptor = new WeavingAdaptor(this); + if (this.aspectURLs.length > 0 || getParent() instanceof WeavingClassLoader) { + try { + adaptor = new WeavingAdaptor(this); + } + catch (ExceptionInInitializerError ex) { + ex.printStackTrace(System.out); + throw ex; + } } +// System.out.println("< WeavingURLClassLoader.WeavingURLClassLoader() adaptor=" + adaptor); } private static String getAspectPath () { @@ -106,26 +113,30 @@ public class WeavingURLClassLoader extends ExtensibleURLClassLoader implements W /* Need to defer creation because of possible recursion during constructor execution */ if (adaptor == null && !initializingAdaptor) { - DefaultWeavingContext weavingContext = new DefaultWeavingContext (this) { - - /* Ensures consistent LTW messages for testing */ - public String getClassLoaderName() { - return loader.getClass().getName(); - } - - }; - - ClassLoaderWeavingAdaptor clwAdaptor = new ClassLoaderWeavingAdaptor(); - initializingAdaptor = true; - clwAdaptor.initialize(this,weavingContext); - initializingAdaptor = false; - adaptor = clwAdaptor; + createAdaptor(); } b = adaptor.weaveClass(name,b); } return super.defineClass(name, b, cs); } + + private void createAdaptor () { + DefaultWeavingContext weavingContext = new DefaultWeavingContext (this) { + + /* Ensures consistent LTW messages for testing */ + public String getClassLoaderName() { + return loader.getClass().getName(); + } + + }; + + ClassLoaderWeavingAdaptor clwAdaptor = new ClassLoaderWeavingAdaptor(); + initializingAdaptor = true; + clwAdaptor.initialize(this,weavingContext); + initializingAdaptor = false; + adaptor = clwAdaptor; + } /** * Override to find classes generated by WeavingAdaptor |