Hi,

I am prototyping some code to include JRuby scripts in a Java app for
extensibility, and found that BSF/JRuby is not reporting compile errors.  I
run a script (with a typo in "include_class") and all I get is this generic
exception:


Dec 20, 2006 9:39:17 AM scratch.test.TestJruby1 main
INFO: org.apache.bsf.BSFException: Exception
org.apache.bsf.BSFException: Exception
        at org.jruby.javasupport.bsf.JRubyEngine.exec(JRubyEngine.java:113)
        at org.apache.bsf.BSFManager$6.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.bsf.BSFManager.exec(Unknown Source)

Here's the code to produce this (concat is a function that builds a string
with newlines between each element):

        BSFManager.registerScriptingEngine("ruby",
"org.jruby.javasupport.bsf.JRubyEngine", new String[] { "rb" });

        String script = concat(
                        new String[] { 
                                        "require 'java'",
                                        "include class 'java.util.HashSet'", // 
ERROR!!!
                                        "begin ",
                                        "  set=HashSet.new",
                                        "  set.add 'foo'",
                                        "  set.add 'bar'",
                                        "  set.add 'fubar'",
                                        "  print set", 
                                        "rescue StandardError => err ", 
                                        "  print \"Error:: \" + err ",
                                        "end ", 
                        });
                                
        BSFManager manager = new BSFManager();
        manager.exec("ruby", "(java)", 1, 1, script);

 shouldn't there be some indication of the compile error?  Running directlly
in JRuby produces this (syntax) error:

$  java -jar lib/jruby.jar c:/tmp/fooBarTest.rb
:[-1,-1]:[0,0]: c:/tmp/fooBarTest.rb:1: syntax error, expecting '['     tDOT   
tCOLON2 but found '\n' instead (SyntaxError)


-- 
View this message in context: 
http://www.nabble.com/Any-error-reporting-in-BSF--tf2860171.html#a7991246
Sent from the BSF - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to