BSF interface - apply nonfunctional with parameters
---------------------------------------------------

                 Key: JRUBY-3782
                 URL: http://jira.codehaus.org/browse/JRUBY-3782
             Project: JRuby
          Issue Type: Bug
          Components: Embedding
    Affects Versions: JRuby 1.3.1
         Environment: Linux Ubuntu 8.04 LTS
Java(TM) SE Runtime Environment (build 1.6.0_10)
            Reporter: Andreas Wundsam
         Attachments: TestRubyBSFApplyBug.java

Calling the BSF interface apply with a non-empty Vector of names and objects 
results in an IndexOutOfBoundsException:

BSFManager m = new BSFManager();
Vector<String> names = new Vector<String>();
Vector<Object> objects = new Vector<Object>();
names.add("activity");
objects.add(new Integer(1));                    
m.apply("ruby", "(java)", 1,1, "puts \"Hello, world: #{activity}\" ", names, 
objects );

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
        at 
org.jruby.runtime.scope.ManyVarsDynamicScope.setValueDepthZero(ManyVarsDynamicScope.java:158)
        at 
org.jruby.runtime.scope.ManyVarsDynamicScope.setValue(ManyVarsDynamicScope.java:151)
        at org.jruby.javasupport.bsf.JRubyEngine.apply(JRubyEngine.java:78)
        at org.apache.bsf.BSFManager$1.run(BSFManager.java:215)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.bsf.BSFManager.apply(BSFManager.java:212)
        at de.lerncultur.script.TestRuby.main(TestRuby.java:25)

As far as I can see, the ManyVarsDynamic scope gets created too early in this 
case. It inherits a variable count of "0" from its enclosing static scope. 
Later, the variable names are set in the static scope, but that does not result 
in a recreationg of the dynamic scope. That's why the actual value assignment 
fails.


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