Skip to content

Fixed issue 1441. Forced check that value was of an appropriate type. #1442

Merged
merged 1 commit into from Jan 27, 2014

2 participants

@eldritchideen

I verified that the issue reported was a difference between MRI and JRuby. Looking at the RubyBigDecimal class it seems to be a fairly simple fix, changing a false to true. After making this change to the "-" method code, I rebuilt JRuby and tried the example again.

Before change:

Stevens-MacBook-Pro:jruby sjc$ ./bin/jruby -S irb
2.1.0 :001 > require 'bigdecimal'
 => true 
2.1.0 :002 > BigDecimal.new("0") - nil
TypeError: nil can't be coerced into BigDecimal
    from org/jruby/ext/bigdecimal/RubyBigDecimal.java:801:in `-'
    from (irb):2:in `evaluate'
    from org/jruby/RubyKernel.java:901:in `eval'
    from org/jruby/RubyKernel.java:1220:in `loop'
    from org/jruby/RubyKernel.java:1031:in `catch'
    from org/jruby/RubyKernel.java:1031:in `catch'
    from /Users/sjc/projects/ruby/jruby/bin/jirb:13:in `(root)'

After change:

Stevens-MacBook-Pro:jruby sjc$ ./bin/jruby -S irb
2.1.0 :001 > require 'bigdecimal'
 => true 
2.1.0 :002 > BigDecimal.new("0") - nil
TypeError: nil can't be coerced into BigDecimal
    from org/jruby/ext/bigdecimal/RubyBigDecimal.java:801:in `-'
    from (irb):2:in `evaluate'
    from org/jruby/RubyKernel.java:901:in `eval'
    from org/jruby/RubyKernel.java:1220:in `loop'
    from org/jruby/RubyKernel.java:1031:in `catch'
    from org/jruby/RubyKernel.java:1031:in `catch'
    from /Users/sjc/projects/ruby/jruby/bin/jirb:13:in `(root)'
2.1.0 :003 > 

This change seems to address the issue. Please let me know if there is something else that I have missed.

@enebo enebo merged commit 2934d5c into jruby:master Jan 27, 2014

1 check failed

Details default The Travis CI build failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.