Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Jan 27, 2014

Conversation

Projects
None yet
2 participants
@eldritchideen
Copy link
Contributor

commented Jan 25, 2014

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 added a commit that referenced this pull request Jan 27, 2014

Merge pull request #1442 from eldritchideen/issue_1441
Fixed issue 1441. Forced check that value was of an appropriate type.

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

1 check failed

default The Travis CI build failed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.