feilong-core 1.11.5,让 Java 开发更简便的工具包

栏目: 软件资讯 · 发布时间: 7年前

内容简介:首先预览下,本次发布的核心内容 : - 精细化异常信息输出,以便快速的定位问题 ### [Feature] :new: * #666 com.feilong.core.lang.NumberUtil.getAddValue(Number...) 要允许null值 所有数加起来. **说明:** - 支持...

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

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

### [Feature] :new:

* #666 com.feilong.core.lang.NumberUtil.getAddValue(Number...) 要允许null值

所有数加起来.

**说明:**

- 支持跳过null 元素相加 (since 1.11.5)
- 但是如果所有元素都是null ,将会抛出 IllegalArgumentException

**示例:**

```JAVA
 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

如下代码

```JAVA
    public void testRuntimeException(){
        try{
            int i = 1 / 0;
        }catch (Exception e){
            throw new RuntimeException("", e);
        }
    }
```

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

```JAVA

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

```JAVA
    public void testDefaultRuntimeException(){
        try{
            int i = 1 / 0;
        }catch (Exception e){
            throw new DefaultRuntimeException("", e);
        }
    }

```

抛出来的信息是这样的

```JAVA

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] :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]

1.11.5 文档地址: http://feilong-core.mydoc.io/ 


【声明】文章转载自:开源中国社区 [http://www.oschina.net]


以上所述就是小编给大家介绍的《feilong-core 1.11.5,让 Java 开发更简便的工具包》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Head First Design Patterns

Head First Design Patterns

Elisabeth Freeman、Eric Freeman、Bert Bates、Kathy Sierra、Elisabeth Robson / O'Reilly Media / 2004-11-1 / USD 49.99

You're not alone. At any given moment, somewhere in the world someone struggles with the same software design problems you have. You know you don't want to reinvent the wheel (or worse, a flat tire),......一起来看看 《Head First Design Patterns》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具