Use of ScriptingContainer causes errors in unrelated tests which use 
ScriptEngine later
---------------------------------------------------------------------------------------

                 Key: JRUBY-4891
                 URL: http://jira.codehaus.org/browse/JRUBY-4891
             Project: JRuby
          Issue Type: Bug
          Components: Embedding
    Affects Versions: JRuby 1.5.1
            Reporter: Trejkaz


I discovered this while testing another issue.  The tests I wrote to reproduce 
that issue caused another of our tests which ran later on to break when running 
all tests.

I condensed it down to a single test.

{code:java}
public class TestScriptEngineIsolation {
    @Test
    public void testIsolation() throws Exception
    {
        // If you comment out these two lines, the test passes:
        ScriptingContainer container = new ScriptingContainer();
        container.runScriptlet("2");

        ScriptEngineManager manager = new ScriptEngineManager();
        ScriptEngine engine = manager.getEngineByExtension("rb");

        try
        {
            engine.put("runnable", new Runnable()
            {
                @Override
                public void run()
                {
                    throw new RuntimeException("Got an error");
                }
            });

            engine.eval("$runnable.run()");
            fail("Expected ScriptException");
        }
        catch (ScriptException e)
        {
            RaiseException cause = (RaiseException) e.getCause();

            // Now we expect the real exception in here.
            RuntimeException realCause = (RuntimeException) cause.getCause();

            assertEquals("Wrong runtime exception", "Got an error", 
realCause.getMessage());
        }
    }

}
{code}


-- 
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

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to