From 51ace9a1a3bbcb24fd2a0f08ff6fdbec27f47738 Mon Sep 17 00:00:00 2001 From: mwebster Date: Mon, 7 Aug 2006 16:38:53 +0000 Subject: [PATCH] Bug 152982 "org.aspectj Restructure - Phase 2: Move tests" (ensure contextClassLoader is set for JCL) --- .../org/aspectj/weaver/loadtime/JRockitAgentTest.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/loadtime/testsrc/org/aspectj/weaver/loadtime/JRockitAgentTest.java b/loadtime/testsrc/org/aspectj/weaver/loadtime/JRockitAgentTest.java index 1bc41b3cc..1448619c9 100644 --- a/loadtime/testsrc/org/aspectj/weaver/loadtime/JRockitAgentTest.java +++ b/loadtime/testsrc/org/aspectj/weaver/loadtime/JRockitAgentTest.java @@ -52,10 +52,15 @@ public class JRockitAgentTest extends TestCase { public void testJrockitRecursionProtection () { URLClassLoader thisLoader = (URLClassLoader)getClass().getClassLoader(); + ClassLoader contextLoader = Thread.currentThread().getContextClassLoader(); + try { + /* Needed by Commons Logging */ + Thread.currentThread().setContextClassLoader(thisLoader.getParent()); + ClassLoader loader = new JRockitClassLoader(thisLoader); + Class clazz; - clazz = Class.forName("java.lang.Object",false,loader); clazz = Class.forName("junit.framework.TestCase",false,loader); } @@ -63,6 +68,9 @@ public class JRockitAgentTest extends TestCase { ex.printStackTrace(); fail(ex.toString()); } + finally { + Thread.currentThread().setContextClassLoader(contextLoader); + } } private class JRockitClassLoader extends ClassLoader { -- 2.39.5