Not possible to 'rescue' exception caused by illegal argument involving a
static field
--------------------------------------------------------------------------------------
Key: JRUBY-3957
URL: http://jira.codehaus.org/browse/JRUBY-3957
Project: JRuby
Issue Type: Bug
Affects Versions: JRuby 1.4
Environment: java 1.6.0_10, ubuntu 8.10
Reporter: Andrew Davey
Assignee: Thomas E Enebo
Attachments: static_field_test_case.patch
If you try to assign a java String to a java static field of type Integer an
IllegalArgumentException is raised. However if you wrap that code in
begin/rescue, the rescue block is never executed and basically your program
crashes.
Example:
If you have the following java class:
{code}
package com.mycompany
public class SomeClass {
public static Integer staticIntegerField = null;
}
and then try and run the ruby code below, the rescue block will not get called.
{code}
def this_will_crash
Java::com.mycompany.SomeClass.staticIntegerField =
Java::java.lang.String.new("blah")
rescue Exception => ex
# this will not get executed
puts "Phew. I caught the error"
end
{code}
*Additional Notes*
I've attached a test case patch.
--
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