mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 00:17:20 +02:00
Prefer Money.zero over Money.of(currency, 0)
In the case where currency has a zero scale (i.e. JPY), Money.of(currency, 0) throws ArithmeticException because the second argument is handled as a double, and JPY (for example) does not allow decimal precision, even if the decimal is zero. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=129023540
This commit is contained in:
parent
3f471a32e2
commit
b2d5108c0c
1 changed files with 1 additions and 1 deletions
|
@ -56,7 +56,7 @@ public final class TldSpecificLogicProxy {
|
|||
* Returns the total cost of all fees for the event.
|
||||
*/
|
||||
public Money getTotalCost() {
|
||||
Money result = Money.of(currency, 0);
|
||||
Money result = Money.zero(currency);
|
||||
for (Fee fee : fees) {
|
||||
result = result.plus(fee.getCost());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue