Details
-
Type: Bug
-
Status: Resolved
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 2.10
-
Fix Version/s: 3.0
-
Component/s: PicoContainer Scripting
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
Description
When run inside a custom classloader, the scripting behaviors vary from one implementation to another.
The test case (Jython Example)
@Test public void testExecutionWithinCustomClassLoader() throws MalformedURLException, ClassNotFoundException { Reader script = new StringReader("" + "from org.picocontainer import *;\n" + "from org.picocontainer.parameters import ComponentParameter;\n" + "pico = PicoBuilder().withLifecycle().withCaching().build();\n" + "pico.addComponent(\"TestComp\",TestComp\n);" ); File testCompJar = TestHelper.getTestCompJarFile(); assertTrue(testCompJar.isFile()); URL compJarURL = testCompJar.toURI().toURL(); final URLClassLoader cl = new URLClassLoader(new URL[] {compJarURL}, getClass().getClassLoader()); assertNotNull(cl.loadClass("TestComp")); ContainerBuilder containerBuilder = new JythonContainerBuilder(script, cl); PicoContainer pico = buildContainer(containerBuilder, null, null); assertNotNull(pico.getComponent("TestComp")); assertEquals("TestComp", pico.getComponent("TestComp").getClass().getName()); }
Status of this bug:
BeanShell: Ok
Groovy : Ok
Rhino : [Failed] but I have it fixed in my local code base and will check in shortly to the Pico 3 codebase.
Jython : [Failed] and I haven't been able to figure out how to fix it.
JRuby : Haven't tried it yet.
Found that JRubyContainerBuilderTestCase.testWithParentClassPathPropagatesWithToInterpreter() already properly tests this issue.
So the only thing left to fix is Jython.