From: mwebster Date: Thu, 27 Jul 2006 09:25:50 +0000 (+0000) Subject: Bug 151182 "NPE in BcelWeaver using LTW" (synchronize(loader) for adaptor create... X-Git-Tag: PRE_PIPELINE~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=397a19d441eaf7fdc67e841232b410358b48ba11;p=aspectj.git Bug 151182 "NPE in BcelWeaver using LTW" (synchronize(loader) for adaptor create, initialize and weave) --- diff --git a/loadtime/src/org/aspectj/weaver/loadtime/Aj.java b/loadtime/src/org/aspectj/weaver/loadtime/Aj.java index 33398f0c5..43de84ef1 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/Aj.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/Aj.java @@ -67,12 +67,14 @@ public class Aj implements ClassPreProcessor { } try { - WeavingAdaptor weavingAdaptor = WeaverContainer.getWeaver(loader, weavingContext); - if (weavingAdaptor == null) { - if (trace.isTraceEnabled()) trace.exit("preProcess",bytes); - return bytes; - } - return weavingAdaptor.weaveClass(className, bytes); + synchronized (loader) { + WeavingAdaptor weavingAdaptor = WeaverContainer.getWeaver(loader, weavingContext); + if (weavingAdaptor == null) { + if (trace.isTraceEnabled()) trace.exit("preProcess",bytes); + return bytes; + } + return weavingAdaptor.weaveClass(className, bytes); + } } catch (Exception t) { trace.error("preProcess",t); //FIXME AV wondering if we should have the option to fail (throw runtime exception) here