首先预览下,本次发布的核心内容 :
精细化异常信息输出,以便快速的定位问题
[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]