This commit is contained in:
Looly
2021-02-03 13:34:41 +08:00
parent 0056560a93
commit fe71315f24
3 changed files with 3 additions and 3 deletions

View File

@@ -736,7 +736,7 @@ public final class JSONUtil {
}
try {
// fix issue#1401@Github
// fix issue#1399@Github
if(object instanceof SQLException){
return object.toString();
}

View File

@@ -183,7 +183,7 @@ public class JSONUtilTest {
@Test
public void sqlExceptionTest(){
//https://github.com/looly/hutool/issues/1401
//https://github.com/looly/hutool/issues/1399
// SQLException实现了Iterable接口默认是遍历之会栈溢出修正后只返回string
final JSONObject set = JSONUtil.createObj().set("test", new SQLException("test"));
Assert.assertEquals("{\"test\":\"java.sql.SQLException: test\"}", set.toString());