-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Description
Hi all!
I saw this was fixed for subtraction and division earlier: #1648, #1633, #1442, #1441
The exception is not caught by a rescue Exception and breaks our app.
This should probably be covered by a RubySpec?
With MRI 2.1.3:
reserve-pc:TelenorGS uwe$ irb
2.1.3 :001 > require 'bigdecimal'
=> true
2.1.3 :003 > BigDecimal('1.23') * nil
TypeError: nil can't be coerced into BigDecimal
from (irb):3:in `*'
from (irb):3
from /Users/uwe/.rvm/rubies/ruby-2.1.3/bin/irb:11:in `<main>'
With JRuby 1.7.16:
reserve-pc:TelenorGS uwe$ irb
jruby-1.7.16 :001 > require 'bigdecimal'
=> true
jruby-1.7.16 :003 > BigDecimal('1.23')
=> #<BigDecimal:5b275dab,'0.123E1',3(4)>
jruby-1.7.16 :004 > BigDecimal('1.23') * nil
Java::JavaLang::NullPointerException:
from org.jruby.ext.bigdecimal.RubyBigDecimal.cannotBeCoerced(RubyBigDecimal.java:428)
from org.jruby.ext.bigdecimal.RubyBigDecimal.mult219(RubyBigDecimal.java:768)
from org.jruby.ext.bigdecimal.RubyBigDecimal.op_mul19(RubyBigDecimal.java:755)
from org.jruby.ext.bigdecimal.RubyBigDecimal$INVOKER$i$1$0$op_mul19.call(RubyBigDecimal$INVOKER$i$1$0$op_mul19.gen)
from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326)
from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
from org.jruby.runtime.callsite.MulCallSite.call(MulCallSite.java:38)
from org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
from org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
from org.jruby.ast.RootNode.interpret(RootNode.java:129)
from org.jruby.evaluator.ASTInterpreter.INTERPRET_EVAL(ASTInterpreter.java:95)
from org.jruby.evaluator.ASTInterpreter.evalWithBinding(ASTInterpreter.java:184)
from org.jruby.RubyKernel.evalCommon(RubyKernel.java:1138)
from org.jruby.RubyKernel.eval19(RubyKernel.java:1101)
from org.jruby.RubyKernel$INVOKER$s$0$3$eval19.call(RubyKernel$INVOKER$s$0$3$eval19.gen)
from org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:180)
... 116 levels...
from org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
from org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
from org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
from org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:198)
from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326)
from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
from Users.uwe.$_dot_rvm.rubies.jruby_minus_1_dot_7_dot_16.bin.irb.__file__(/Users/uwe/.rvm/rubies/jruby-1.7.16/bin/irb:13)
from Users.uwe.$_dot_rvm.rubies.jruby_minus_1_dot_7_dot_16.bin.irb.load(/Users/uwe/.rvm/rubies/jruby-1.7.16/bin/irb)
from org.jruby.Ruby.runScript(Ruby.java:863)
from org.jruby.Ruby.runScript(Ruby.java:856)
from org.jruby.Ruby.runNormally(Ruby.java:725)
from org.jruby.Ruby.runFromMain(Ruby.java:574)
from org.jruby.Main.doRunFromMain(Main.java:395)
from org.jruby.Main.internalRun(Main.java:290)
from org.jruby.Main.run(Main.java:217)
from org.jruby.Main.main(Main.java:197)
Reactions are currently unavailable