java.long.runt_feilong-core 1.11.5,让 Java 开发更简便的工具包

首先预览下,本次发布的核心内容 :

精细化异常信息输出,以便快速的定位问题

[Feature] 🆕

#666 com.feilong.core.lang.NumberUtil.getAddValue(Number…) 要允许null值所有数加起来.

说明:

支持跳过null 元素相加 (since 1.11.5)

但是如果所有元素都是null ,将会抛出 IllegalArgumentException

示例:

NumberUtil.getAddValue(2, 4, 5)              =   11

NumberUtil.getAddValue(new BigDecimal(6), 5) =   11

NumberUtil.getAddValue(new BigDecimal(6), null) =   6

#751 新建 feilong runtime exception DefaultRuntimeException

主要作用,是在异常message 中追加 cause exception信息,方便查看排查问题

对比

empty message

如下代码

public void testRuntimeException(){

try{

int i = 1 / 0;

}catch (Exception e){

throw new RuntimeException("", e);

}

}

抛出的异常情况在控制台是这样的

java.lang.RuntimeException:

at com.feilong.core.DefaultRuntimeExceptionTest.testRuntimeException(DefaultRuntimeExceptionTest.java:63)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at java.lang.reflect.Method.invoke(Method.java:606)

Caused by: java.lang.ArithmeticException: / by zero

at com.feilong.core.DefaultRuntimeExceptionTest.testRuntimeException(DefaultRuntimeExceptionTest.java:61)

... 23 more

而如果使用 DefaultRuntimeException

public void testDefaultRuntimeException(){

try{

int i = 1 / 0;

}catch (Exception e){

throw new DefaultRuntimeException("", e);

}

}

抛出来的信息是这样的

com.feilong.core.DefaultRuntimeException: **java.lang.ArithmeticException: / by zero**

at com.feilong.core.DefaultRuntimeExceptionTest.testDefaultRuntimeException(DefaultRuntimeExceptionTest.java:53)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

Caused by: java.lang.ArithmeticException: / by zero

at com.feilong.core.DefaultRuntimeExceptionTest.testDefaultRuntimeException(DefaultRuntimeExceptionTest.java:51)

... 23 more

[Update]

#747 MethodUtil.invokeStaticMethod(Class>, String, Object[], Class>[]) 支持 私有的静态方法

[Remove]

none

[Fix Bug] 🐛

none

[javadoc]

#742 ConvertUtil 修改 toBoolean(Object toBeConvertedValue) javadoc

[test]

#753 CollectionsUtil new 相关方法添加单元测试

[help wanted]

#750 修改 FieldUtil 异常信息

#746 修改 PropertyUtil 异常信息

#749 修改 ConstructorUtil 异常消息

#748 修改 ClassUtil 类异常提示

#739 更改 com.feilong.core.bean.BeanUtil 异常提示

#745 修改 Stringutil getBytes 异常提示信息

#744 修改 URLUtil 异常提示信息

#743 修改 URIUtil 相关异常message

#742 修改 SortUtil parsePropertyNameAndOrder 方法异常message

#741 修改 DateUtil toDate 的报错异常信息

本次升级共有 15 处变更, 具体参见 [1.11.5 milestone]

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值