Message method value of Exception is missing in Java when exception raised in
ruby
----------------------------------------------------------------------------------
Key: JRUBY-3007
URL: http://jira.codehaus.org/browse/JRUBY-3007
Project: JRuby
Issue Type: Bug
Components: Java Integration
Affects Versions: JRuby 1.1.4
Environment: Mac OS 10.5
Reporter: Ian Taylor
Attachments: java_exception_bug.rb
I'm using JRuby through the JSR 223 scripting, and when I raise an exception
with my ruby code and catch it in Java, I get the stacktrace, but the
getMessage field is null, and the stack traces do not contain the messages
associated with the exceptions.
In playing around to try to figure out what was wrong, I stumbled across bug
2673 which is fixed, but with a few changes to the test referenced there,
allows me to reproduce the missing .message field without using JSR 223 by
registering a global exception handler for a thread. I tried to take a look at
the code to figure out how to fix the issue, but I got into RubyException.java
and I got a bit lost.
Below is one of the stack traces returned to me, when I run the following ruby
code: notice that ScriptException's message is just
"org.jruby.exceptions.RaiseException" and the "bomb" message that I raised is
nowhere in the output.
My ruby code for this looks like:
class TheHamlStarter
def startHaml(templateName)
raise 'bomb';
end
end
st = TheHamlStarter.new()
Caused by: javax.script.ScriptException: org.jruby.exceptions.RaiseException
at
com.sun.script.jruby.JRubyScriptEngine.invokeImpl(JRubyScriptEngine.java:518)
at
com.sun.script.jruby.JRubyScriptEngine.invokeMethod(JRubyScriptEngine.java:145)
Caused by: org.jruby.exceptions.RaiseException
at Kernel.raise(<unknown>:5)
at TheHamlStarter.startHaml(:1)
at (unknown).(unknown)(:1)
I can create a unit test that uses JSR223 if you think that would help, but it
seems like it is likely the same problem exposed by the attached .rb file.
--
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