aboutsummaryrefslogtreecommitdiffstats
path: root/loadtime
diff options
context:
space:
mode:
authoraclement <aclement>2010-08-10 16:03:11 +0000
committeraclement <aclement>2010-08-10 16:03:11 +0000
commitd266e547aca31ae96fd8d469620b036ae9430989 (patch)
tree6570704be617fc865cdc42216fb8c420ed4c2469 /loadtime
parent3e26fa139931011feb52d7a542deecfb97401ab0 (diff)
downloadaspectj-d266e547aca31ae96fd8d469620b036ae9430989.tar.gz
aspectj-d266e547aca31ae96fd8d469620b036ae9430989.zip
175814: fixes: chaining preclinits if they are too large (too many tjpsps) and on error define original form of class and proceed, rather than failing completely
Diffstat (limited to 'loadtime')
-rw-r--r--loadtime/src/org/aspectj/weaver/loadtime/WeavingURLClassLoader.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/loadtime/src/org/aspectj/weaver/loadtime/WeavingURLClassLoader.java b/loadtime/src/org/aspectj/weaver/loadtime/WeavingURLClassLoader.java
index eab084fb6..94ca39af1 100644
--- a/loadtime/src/org/aspectj/weaver/loadtime/WeavingURLClassLoader.java
+++ b/loadtime/src/org/aspectj/weaver/loadtime/WeavingURLClassLoader.java
@@ -9,6 +9,8 @@
* Contributors:
* Matthew Webster, Adrian Colyer,
* Martin Lippert initial implementation
+ * Andy Clement
+ * Abraham Nevado
* ******************************************************************/
package org.aspectj.weaver.loadtime;
@@ -121,7 +123,7 @@ public class WeavingURLClassLoader extends ExtensibleURLClassLoader implements W
if (trace.isTraceEnabled())
trace.enter("defineClass", this, new Object[] { name, b, cs });
// System.err.println("? WeavingURLClassLoader.defineClass(" + name + ", [" + b.length + "])");
-
+ byte orig[] = b;
/* Avoid recursion during adaptor initialization */
if (!initializingAdaptor) {
@@ -139,7 +141,15 @@ public class WeavingURLClassLoader extends ExtensibleURLClassLoader implements W
trace.error("defineClass", th);
}
}
- Class clazz = super.defineClass(name, b, cs);
+ Class clazz;
+
+ // On error, define the original form of the class and log the issue
+ try {
+ clazz= super.defineClass(name, b, cs);
+ } catch (Throwable th) {
+ trace.error("Weaving class problem. Original class has been returned. The error was caused because of: " + th, th);
+ clazz= super.defineClass(name, orig, cs);
+ }
if (trace.isTraceEnabled())
trace.exit("defineClass", clazz);
return clazz;