From bsf-user-return-231-apmail-jakarta-bsf-user-archive=jakarta.apache.org@jakarta.apache.org Thu Dec 28 16:43:39 2006 Return-Path: Delivered-To: apmail-jakarta-bsf-user-archive@www.apache.org Received: (qmail 26497 invoked from network); 28 Dec 2006 16:43:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Dec 2006 16:43:39 -0000 Received: (qmail 92188 invoked by uid 500); 28 Dec 2006 16:43:45 -0000 Delivered-To: apmail-jakarta-bsf-user-archive@jakarta.apache.org Received: (qmail 92031 invoked by uid 500); 28 Dec 2006 16:43:45 -0000 Mailing-List: contact bsf-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Bean Scripting Framework users" Reply-To: "Bean Scripting Framework users" Delivered-To: mailing list bsf-user@jakarta.apache.org Received: (qmail 92020 invoked by uid 99); 28 Dec 2006 16:43:45 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Dec 2006 08:43:45 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [137.208.8.46] (HELO sslmail2.wu-wien.ac.at) (137.208.8.46) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Dec 2006 08:43:34 -0800 Received: from [137.208.224.186] (abt-wi-027.wu-wien.ac.at [137.208.224.186]) (authenticated bits=0) by sslmail2.wu-wien.ac.at (8.13.3/8.13.1) with ESMTP id kBSGgN8m078878 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Thu, 28 Dec 2006 17:42:24 +0100 (CET) (envelope-from Rony.Flatscher@wu-wien.ac.at) Message-ID: <4593F3EE.9070103@wu-wien.ac.at> Date: Thu, 28 Dec 2006 17:42:22 +0100 From: "Rony G. Flatscher" User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: Bean Scripting Framework users Subject: Re: Any error reporting in BSF? References: <7991246.post@talk.nabble.com> In-Reply-To: <7991246.post@talk.nabble.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-WU-wumi-status: clean v5.1.00/v4927 sslmail2 world ba1e4759449ce50070b8e125ab9e6bee X-Virus-Checked: Checked by ClamAV on apache.org Hi Big d, > 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: > At one point in time an explicit debugging subsystem was experimentally created for BSF, but got later removed. (Each language has usually its own means of debugging.) What you get is the exception info originating from the JRubyEngine. So in your particular case that would be the place to add code which would give you more (JRuby-related) information about the exception condition (in your case that a syntax error was found by JRuby). HTH a little bit, ---rony --------------------------------------------------------------------- To unsubscribe, e-mail: bsf-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: bsf-user-help@jakarta.apache.org