From 84226fc188d2e5deb532d0d49841ffbd019670b1 Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 5 May 2010 16:51:48 +0000 Subject: [PATCH] 311762 --- .../loadtime/WeavingURLClassLoaderTest.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java b/loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java index 98e427833..0305b9660 100644 --- a/loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java +++ b/loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java @@ -83,6 +83,20 @@ public class WeavingURLClassLoaderTest extends TestCase { } } + public void testGarbageName() { + setSystemProperty(WeavingURLClassLoader.WEAVING_ASPECT_PATH, ""); + setSystemProperty(WeavingURLClassLoader.WEAVING_CLASS_PATH, WOVEN_JAR); + WeavingURLClassLoader loader = new WeavingURLClassLoader(getClass().getClassLoader()); + + try { + loader.loadClass("[Lorg.springframework.webflow.config.FlowLocation;Editor"); + } catch (ClassNotFoundException cnfe) { + // success! + } catch (Exception ex) { + fail(ex.toString()); + } + } + /* * We get an exception because the class was not built reweavable */ @@ -490,10 +504,11 @@ public class WeavingURLClassLoaderTest extends TestCase { method.invoke(null, params); } catch (InvocationTargetException ex) { Throwable targetException = ex.getTargetException(); - if (targetException instanceof RuntimeException) + if (targetException instanceof RuntimeException) { throw (RuntimeException) ex.getTargetException(); - else + } else { throw new RuntimeException(ex.getTargetException().toString()); + } } catch (Exception ex) { throw new RuntimeException(ex.toString()); } @@ -523,10 +538,11 @@ public class WeavingURLClassLoaderTest extends TestCase { for (Enumeration enu = savedProperties.keys(); enu.hasMoreElements();) { String key = (String) enu.nextElement(); String value = savedProperties.getProperty(key); - if (value == NULL) + if (value == NULL) { systemProperties.remove(key); - else + } else { systemProperties.setProperty(key, value); + } } } -- 2.39.5