Community
Participate
Working Groups
AspectJ 5 load-time weaving in CVS HEAD isn't loading aop.xml files properly from a jar file without specifying the global -D flag. The following patch fixes the problem for me so I can load aop.xml files from jars on the classpath without a global flag: ClassLoaderWeavingAdaptor.java:109: - Enumeration xmls = loader.getResources("/META-INF/aop.xml"); + Enumeration xmls = loader.getResources("META-INF/aop.xml"); I.e., getResources doesn't work with a leading separator, at least not on the Sun VM or JRockIt on Windows. Writing a unit test for this would require significant changes to the loadtime module, so I wrote a standalone test of the API: public class TestApi extends TestCase { public void testLoadResource() throws Exception { URL urlList[] = { new URL ("file:testsrc/org/aspectj/weaver/loadtime/test/sample.jar") }; ClassLoader loader = new URLClassLoader(urlList); Enumeration xmls = loader.getResources("META-INF/aop.xml"); //this version fails: //Enumeration xmls = loader.getResources("/META-INF/aop.xml"); assertTrue(xmls.hasMoreElements()); } }
Created attachment 21605 [details] Sample jar to use with sample unit test case
Thanks Ron :) I've assigned to Alex since I'm going to be out of contact for the next few days and Andy is at a conference in Vegas...
done