mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
fix json
This commit is contained in:
parent
0056560a93
commit
fe71315f24
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
### Bug修复
|
### Bug修复
|
||||||
* 【json 】 JSONUtil.isJson方法改变trim策略,解决特殊空白符导致判断失败问题
|
* 【json 】 JSONUtil.isJson方法改变trim策略,解决特殊空白符导致判断失败问题
|
||||||
* 【json 】 修复SQLEXception导致的栈溢出(issue#1401@Github)
|
* 【json 】 修复SQLEXception导致的栈溢出(issue#1399@Github)
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -736,7 +736,7 @@ public final class JSONUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// fix issue#1401@Github
|
// fix issue#1399@Github
|
||||||
if(object instanceof SQLException){
|
if(object instanceof SQLException){
|
||||||
return object.toString();
|
return object.toString();
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ public class JSONUtilTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sqlExceptionTest(){
|
public void sqlExceptionTest(){
|
||||||
//https://github.com/looly/hutool/issues/1401
|
//https://github.com/looly/hutool/issues/1399
|
||||||
// SQLException实现了Iterable接口,默认是遍历之,会栈溢出,修正后只返回string
|
// SQLException实现了Iterable接口,默认是遍历之,会栈溢出,修正后只返回string
|
||||||
final JSONObject set = JSONUtil.createObj().set("test", new SQLException("test"));
|
final JSONObject set = JSONUtil.createObj().set("test", new SQLException("test"));
|
||||||
Assert.assertEquals("{\"test\":\"java.sql.SQLException: test\"}", set.toString());
|
Assert.assertEquals("{\"test\":\"java.sql.SQLException: test\"}", set.toString());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user