Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a5bb1e3da8de
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e86c673ba2c3
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Nov 13, 2014

  1. Copy the full SHA
    2828c5c View commit details
  2. Merge pull request #2192 from k77ch7/GH-2050_on_master

    Fix for issue 2050 on master: BigDecimal and nil multiplication
    enebo committed Nov 13, 2014
    Copy the full SHA
    e86c673 View commit details
18 changes: 14 additions & 4 deletions core/src/main/java/org/jruby/ext/bigdecimal/RubyBigDecimal.java
Original file line number Diff line number Diff line change
@@ -406,11 +406,21 @@ private static boolean isOverflowExceptionMode(Ruby runtime) {
}

private static RubyBigDecimal cannotBeCoerced(ThreadContext context, IRubyObject v, boolean must) {
if (!must) return null;
if (must) {
String err;

String err = v.isImmediate() ? RubyObject.inspect(context, v).toString() : v.getMetaClass().getBaseName();

throw context.runtime.newArgumentError(err + " can't be coerced into BigDecimal");
if (v == null) {
err = "nil";
} else if (v.isImmediate()) {
err = RubyObject.inspect(context, v).toString();
} else {
err = v.getMetaClass().getBaseName();
}

throw context.runtime.newTypeError(err + " can't be coerced into BigDecimal");
}

return null;
}

private static RubyBigDecimal unableToCoerceWithoutPrec(ThreadContext context, IRubyObject v, boolean must) {