diff options
author | aclement <aclement> | 2006-05-04 07:14:47 +0000 |
---|---|---|
committer | aclement <aclement> | 2006-05-04 07:14:47 +0000 |
commit | 5a01932b9dbdf81fe41e029fa56ede17364a2c2e (patch) | |
tree | a2991f73f2b496670e3de21f00538fbae9da891d /loadtime | |
parent | cb5dfe759852d4965c692934ed7e14c41f61b715 (diff) | |
download | aspectj-5a01932b9dbdf81fe41e029fa56ede17364a2c2e.tar.gz aspectj-5a01932b9dbdf81fe41e029fa56ede17364a2c2e.zip |
fixes for 137235 (contributed by Ron): more intelligent logic for determining if a path entry is a jar/zip (don't just rely on suffix, some new .bndl files seem to be becoming popular...)
Diffstat (limited to 'loadtime')
-rw-r--r-- | loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java b/loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java index 71a00ad2f..13c22cc84 100644 --- a/loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java +++ b/loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java @@ -30,8 +30,6 @@ import org.aspectj.weaver.tools.WeavingAdaptor; /** * @author websterm * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments */ public class WeavingURLClassLoaderTest extends TestCase { @@ -432,6 +430,35 @@ public class WeavingURLClassLoaderTest extends TestCase { } } + public void testWeavingURLClassLoaderOddJars() throws Exception { + URL classes = FileUtil.getFileURL(new File(TEST_BASE+"/test.jar/main.file")); + URL aspectjrt = FileUtil.getFileURL(new File(ASPECTJRT)); + URL aspects = FileUtil.getFileURL(new File(TEST_BASE+"/aspectNoExt")); + URL[] classURLs = new URL[] { aspects, classes, aspectjrt }; + URL[] aspectURLs = new URL[] { aspects }; + WeavingURLClassLoader loader = new WeavingURLClassLoader(classURLs,aspectURLs,getClass().getClassLoader()); + + Class clazz = loader.loadClass("packag.Main"); + invokeMain(clazz,new String[] { }); + } + + public void testWeavingURLClassLoaderMissingJars() throws Exception { + try { + URL classes = FileUtil.getFileURL(new File(TEST_BASE+"/test.jar/main.file")); + URL aspectjrt = FileUtil.getFileURL(new File(ASPECTJRT)); + URL aspects = FileUtil.getFileURL(new File(TEST_BASE+"/MissingFile")); + URL[] classURLs = new URL[] { aspects, classes, aspectjrt }; + URL[] aspectURLs = new URL[] { aspects }; + WeavingURLClassLoader loader = new WeavingURLClassLoader(classURLs,aspectURLs,getClass().getClassLoader()); + + Class clazz = loader.loadClass("packag.Main"); + invokeMain(clazz,new String[] { }); + fail("Should reject bad aspect MissingFile"); + } catch (AbortException ae) { + assertTrue("Unexpected cause: "+ae.getMessage(), ae.getMessage().indexOf("bad aspect library")!=-1); + } + } + private void doTestZipAspects(String aspectLib) throws Exception { File classZip = new File(TEST_BASE + "/main.zip"); File zipLib = new File(aspectLib); |