Can't run with 1.9 compatibility in browser (Firefox 3.0.13, Java 1.5.0_19);
easy to check with tweak to stock JRubyApplet
--------------------------------------------------------------------------------------------------------------------------
Key: JRUBY-3900
URL: http://jira.codehaus.org/browse/JRUBY-3900
Project: JRuby
Issue Type: Bug
Components: Embedding
Affects Versions: JRuby 1.3.1
Environment: Firefox 3.0.13; Java 1.5.0_19; Mac OS/X 10.5.8
Reporter: John Norman
I have been trying to evaluate Ruby scriptlets in an applet but setting
.setCompatVersion(CompatVersion.RUBY1_9) on a RubyInstanceConfig.
I get an exception: undefined method 'sub' for nil:NilClass
To try this, I simply altered the stock JRubyApplet that comes with 1.3.1 --
e.g., in init(), modified as so:
final RubyInstanceConfig config = new RubyInstanceConfig() {{
setCompatVersion(CompatVersion.RUBY1_9);
I also wrote a very, very simple applet with less of a superstructure around it
for UI. It also works in default compat (1.8.6) but generates the same
exception for 1.9. To this applet, I added a simple main() method to test it
from the console: Works fine there. Just not in Firefox as an Applet.
Example (tried to keep this as simple as possible):
import java.applet.Applet;
import java.util.ArrayList;
import org.jruby.Ruby;
import org.jruby.RubyRuntimeAdapter;
import org.jruby.javasupport.JavaEmbedUtils;
import org.jruby.RubyInstanceConfig;
import org.jruby.CompatVersion;
public class RubyApplet extends Applet {
private Ruby ruby;
private RubyRuntimeAdapter rra;
public void init() {
super.init();
RubyInstanceConfig ric = new RubyInstanceConfig();
// next line causes exception when run from browser
ric.setCompatVersion(CompatVersion.RUBY1_9);
ruby = JavaEmbedUtils.initialize(new ArrayList(), ric);
rra = JavaEmbedUtils.newRuntimeAdapter();
}
public String evalRuby(String code) {
try {
Object o = rra.eval(ruby, code);
return o.toString();
} catch (Exception e) {
return e.toString();
}
}
// works fine outside browser
public static void main(String[] args) {
RubyApplet ra = new RubyApplet();
ra.init();
System.out.println(ra.evalRuby("RUBY_VERSION"));
}
}
--
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