Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.0.0, JRuby 1.0.1, JRuby 1.0.2, JRuby 1.1b1
-
Fix Version/s: JRuby 1.0.3, JRuby 1.1RC2
-
Component/s: Core Classes/Modules
-
Labels:None
-
Environment:OS X 10.4.10 with Java 5
-
Testcase included:yes
-
Number of attachments :
Description
Calling YAML.load with something like an empty hash or array raises a java.lang.IllegalArgumentException with the text "Object: is not a legal argument to this wrapper, cause it doesn't respond to "read"." instead of a Ruby TypeError with the text "instance of IO needed."
A test case is attached; on JRuby 1.0.2 the bad exception is caught and handled by Test::Unit, but on JRuby 1.1b1 it flys all the way to the top and kills the process. The test passes in C Ruby.
Paste of the test case:
=================
require "test/unit"
require "yaml"
class YamlLoadTest < Test::Unit::TestCase
def test_yaml_load_with_bad_type_raises_typeerror
[[], {}].each do |not_an_IO_object|
err = assert_raise(TypeError) do
YAML.load(not_an_IO_object)
end
assert_match("instance of IO needed", err.message)
end
end
end
=================
Ugly! Fix for 1.0.3 and 1.1.