Bug 96371 - Patch to support loading aop.xml properly
Summary: Patch to support loading aop.xml properly
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.5.0 M3   Edit
Assignee: Alexandre Vasseur CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-23 17:22 EDT by Ron Bodkin CLA
Modified: 2005-05-30 05:59 EDT (History)
0 users

See Also:


Attachments
Sample jar to use with sample unit test case (553 bytes, application/x-zip-compressed)
2005-05-23 17:24 EDT, Ron Bodkin CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ron Bodkin CLA 2005-05-23 17:22:52 EDT
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());
    }
}
Comment 1 Ron Bodkin CLA 2005-05-23 17:24:01 EDT
Created attachment 21605 [details]
Sample jar to use with sample unit test case
Comment 2 Adrian Colyer CLA 2005-05-23 17:31:05 EDT
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...

Comment 3 Alexandre Vasseur CLA 2005-05-30 05:59:55 EDT
done