]> source.dussan.org Git - aspectj.git/commitdiff
Bug 151182 "NPE in BcelWeaver using LTW" (synchronize(loader) for adaptor create...
authormwebster <mwebster>
Thu, 27 Jul 2006 09:25:50 +0000 (09:25 +0000)
committermwebster <mwebster>
Thu, 27 Jul 2006 09:25:50 +0000 (09:25 +0000)
loadtime/src/org/aspectj/weaver/loadtime/Aj.java

index 33398f0c5c2c0a84ecc7f06594e54ac440d50278..43de84ef1fb58fee61a36ad75da686d66a52c8b3 100644 (file)
@@ -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