summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormwebster <mwebster>2006-08-07 16:38:53 +0000
committermwebster <mwebster>2006-08-07 16:38:53 +0000
commit51ace9a1a3bbcb24fd2a0f08ff6fdbec27f47738 (patch)
tree9d948e6a3c646d798fa315d845bb51cc28db951b
parentc6b01b10d34c2ad9464ea11321547515b4077087 (diff)
downloadaspectj-51ace9a1a3bbcb24fd2a0f08ff6fdbec27f47738.tar.gz
aspectj-51ace9a1a3bbcb24fd2a0f08ff6fdbec27f47738.zip
Bug 152982 "org.aspectj Restructure - Phase 2: Move tests" (ensure contextClassLoader is set for JCL)
-rw-r--r--loadtime/testsrc/org/aspectj/weaver/loadtime/JRockitAgentTest.java10
1 files changed, 9 insertions, 1 deletions
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 {