mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-11-16 15:58:08 +00:00
log error on infinity in offer book chart view without popup #1340
This commit is contained in:
parent
bc1cfe3ba0
commit
123a2a8487
1 changed files with 13 additions and 8 deletions
|
@ -207,16 +207,21 @@ public class OfferBookChartView extends ActivatableViewAndModel<VBox, OfferBookC
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(Number object) {
|
public String toString(Number object) {
|
||||||
final double doubleValue = (double) object;
|
try {
|
||||||
if (CurrencyUtil.isCryptoCurrency(model.getCurrencyCode())) {
|
final double doubleValue = (double) object;
|
||||||
final String withCryptoPrecision = FormattingUtils.formatRoundedDoubleWithPrecision(doubleValue, cryptoPrecision);
|
if (CurrencyUtil.isCryptoCurrency(model.getCurrencyCode())) {
|
||||||
if (withCryptoPrecision.startsWith("0.0")) {
|
final String withCryptoPrecision = FormattingUtils.formatRoundedDoubleWithPrecision(doubleValue, cryptoPrecision);
|
||||||
return FormattingUtils.formatRoundedDoubleWithPrecision(doubleValue, 8).replaceFirst("0+$", "");
|
if (withCryptoPrecision.startsWith("0.0")) {
|
||||||
|
return FormattingUtils.formatRoundedDoubleWithPrecision(doubleValue, 8).replaceFirst("0+$", "");
|
||||||
|
} else {
|
||||||
|
return withCryptoPrecision.replaceFirst("0+$", "");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return withCryptoPrecision.replaceFirst("0+$", "");
|
return df.format(Double.parseDouble(FormattingUtils.formatRoundedDoubleWithPrecision(doubleValue, 0)));
|
||||||
}
|
}
|
||||||
} else {
|
} catch (IllegalArgumentException e) {
|
||||||
return df.format(Double.parseDouble(FormattingUtils.formatRoundedDoubleWithPrecision(doubleValue, 0)));
|
log.error("Error converting number to string, tradeCurrency={}, number={}\n", code, object, e);
|
||||||
|
return "NaN"; // TODO: occasionally getting invalid number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue