]> source.dussan.org Git - aspectj.git/commitdiff
231945: guard on null and tell them what to do about it
authoraclement <aclement>
Thu, 10 Dec 2009 22:25:35 +0000 (22:25 +0000)
committeraclement <aclement>
Thu, 10 Dec 2009 22:25:35 +0000 (22:25 +0000)
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java

index f9060140d1133e293fccd427ab6d7ea1ab292327..80c523024b261b9e89f1223164fbe8a2fd23b082 100644 (file)
@@ -275,6 +275,12 @@ public class WeavingAdaptor implements IMessageContext {
         * @exception IOException weave failed
         */
        public byte[] weaveClass(String name, byte[] bytes, boolean mustWeave) throws IOException {
+               if (trace==null) {
+                       // Pr231945: we are likely to be under tomcat and ENABLE_CLEAR_REFERENCES hasn't been set
+                       System.err.println("AspectJ Weaver cannot continue, static state has been cleared.  Are you under Tomcat? In order to weave '"+name+
+                                       "' during shutdown, 'org.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false' must be set (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=231945).");
+                       return bytes;
+               }
                if (weaverRunning.get()) {
                        // System.out.println("AJC: avoiding re-entrant call to transform " + name);
                        return bytes;