mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
修复NumberUtil mul 传入null的string入参报错问题
This commit is contained in:
parent
049086aa79
commit
0252bd7445
@ -2,7 +2,7 @@
|
||||
# 🚀Changelog
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
# 5.8.19.M1 (2023-04-27)
|
||||
# 5.8.19.M1 (2023-05-05)
|
||||
|
||||
### 🐣新特性
|
||||
* 【db 】 优化HttpRequest.toString()内容打印(issue#3072@Github)
|
||||
@ -15,9 +15,10 @@
|
||||
* 【core 】 修复HtmlUtil的removeHtmlAttr方法匹配问题(issue#I6YNTF@Gitee)
|
||||
* 【core 】 修复JSONUtil.toBean目标存在Map字段无序问题(issue#I6YN2A@Gitee)
|
||||
* 【http 】 修复HttpDownloader.downloadFile 方法缺少static问题(issue#I6Z8VU@Gitee)
|
||||
* 【core 】 修复NumberUtil mul 传入null的string入参报错问题(issue#I70JB3@Gitee)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
# 5.8.18 (2023-05-04)
|
||||
# 5.8.18 (2023-04-27)
|
||||
|
||||
### 🐣新特性
|
||||
* 【extra 】 JschUtil新增一个重载方法以支持私钥以byte数组形式载入(pr#3057@Github)
|
||||
|
@ -429,10 +429,10 @@ public class NumberUtil {
|
||||
}
|
||||
|
||||
Number value = values[0];
|
||||
BigDecimal result = new BigDecimal(value.toString());
|
||||
BigDecimal result = toBigDecimal(value.toString());
|
||||
for (int i = 1; i < values.length; i++) {
|
||||
value = values[i];
|
||||
result = result.multiply(new BigDecimal(value.toString()));
|
||||
result = result.multiply(toBigDecimal(value.toString()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -446,7 +446,7 @@ public class NumberUtil {
|
||||
* @since 3.0.8
|
||||
*/
|
||||
public static BigDecimal mul(String v1, String v2) {
|
||||
return mul(new BigDecimal(v1), new BigDecimal(v2));
|
||||
return mul(toBigDecimal(v1), toBigDecimal(v2));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -462,9 +462,9 @@ public class NumberUtil {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
BigDecimal result = new BigDecimal(values[0]);
|
||||
BigDecimal result = toBigDecimal(values[0]);
|
||||
for (int i = 1; i < values.length; i++) {
|
||||
result = result.multiply(new BigDecimal(values[i]));
|
||||
result = result.multiply(toBigDecimal(values[i]));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user