[picocontainer-scm] [jira] Created: (PICO-378) Inconsistent Script Behavior When Run in Custom ClassLoader

"Michael Rimov (JIRA)" <jira-yCVjj/[email protected]> Fri, 24 Dec 2010 14:02:57 -0600 (CST)
Newsgroups gmane.comp.java.picocontainer.cvs
Message-ID <26566046.14111.1293220977806.JavaMail.haus-jira@codehaus01.managed.contegix.com>
Inconsistent Script Behavior When Run in Custom ClassLoader
-----------------------------------------------------------

                 Key: PICO-378
                 URL: http://jira.codehaus.org/browse/PICO-378
             Project: PicoContainer
          Issue Type: Bug
          Components: PicoContainer Scripting
    Affects Versions: 2.10
            Reporter: Michael Rimov


When run inside a custom classloader, the scripting behaviors vary from one implementation to another.

The test case (Jython Example)

{code}

	@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());
		
	}
{code}

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.




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>