Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.3.1
    • Fix Version/s: JRuby 1.4
    • Component/s: Embedding
    • Labels:
      None
    • Environment:
      Linux Ubuntu 8.04 LTS
      Java(TM) SE Runtime Environment (build 1.6.0_10)
    • Testcase included:
      yes
    • Number of attachments :
      1

      Description

      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.

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        Sounds like the apply implementation for our BSF engine should be forcing the scope to recalculate size if necessary. Maybe you can dig up where that happens and provide a patch?

        Show
        Charles Oliver Nutter added a comment - Sounds like the apply implementation for our BSF engine should be forcing the scope to recalculate size if necessary. Maybe you can dig up where that happens and provide a patch?
        Hide
        Thomas E Enebo added a comment -

        JRuby-embed landing now works fine with BSF because it was re-implemented.

        Show
        Thomas E Enebo added a comment - JRuby-embed landing now works fine with BSF because it was re-implemented.

          People

          • Assignee:
            Thomas E Enebo
            Reporter:
            Andreas Wundsam
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: