json-iterator / java

jsoniter (json-iterator) is fast and flexible JSON parser available in Java and Go
http://jsoniter.com/
MIT License
1.51k stars 519 forks source link

递归循环报错,引发StackOverflowError #351

Open eastlong opened 10 months ago

eastlong commented 10 months ago

问题:递归循环报错,引发StackOverflowError

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        JsonStream.serialize(checkParameter.getParams(), out);

其中:checkParameter.getParams()是一个map 执行报错: aused by: java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.baidu.openrasp.jsoniter.output.ReflectionObjectEncoder.enocde(ReflectionObjectEncoder.java:77) ... 1020 more Caused by: java.lang.StackOverflowError at java.util.LinkedHashMap.get(LinkedHashMap.java:280) at java.io.ExpiringCache.entryFor(ExpiringCache.java:83) at java.io.ExpiringCache.get(ExpiringCache.java:58) at java.io.Win32FileSystem.canonicalize(Win32FileSystem.java:377) at java.io.File.getCanonicalPath(File.java:559) at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.baidu.openrasp.jsoniter.output.ReflectionObjectEncoder.enocde(ReflectionObjectEncoder.java:77) at com.baidu.openrasp.jsoniter.output.ReflectionObjectEncoder.encode(ReflectionObjectEncoder.java:37) at com.baidu.openrasp.jsoniter.output.JsonStream.writeVal(JsonStream.java:362) at com.baidu.openrasp.jsoniter.output.ReflectionObjectEncoder.writeEncodeTo(ReflectionObjectEncoder.java:121) at com.baidu.openrasp.jsoniter.output.ReflectionObjectEncoder.enocde(ReflectionObjectEncoder.java:78) at com.baidu.openrasp.jsoniter.output.ReflectionObjectEncoder.encode(ReflectionObjectEncoder.java:37) at com.baidu.openrasp.jsoniter.output.JsonStream.writeVal(JsonStream.java:362) at com.baidu.openrasp.jsoniter.output.ReflectionObjectEncoder.writeEncodeTo(ReflectionObjectEncoder.java:121) at com.baidu.openrasp.jsoniter.output.ReflectionObjectEncoder.enocde(ReflectionObjectEncoder.java:78) at com.baidu.openrasp.jsoniter.output.ReflectionObjectEncoder.encode(ReflectionObjectEncoder.java:37) at com.baidu.openrasp.jsoniter.output.JsonStream.writeVal(JsonStream.java:362) at com.baidu.openrasp.jsoniter.output.ReflectionObjectEncoder.writeEncodeTo(ReflectionObjectEncoder.java:121) at com.baidu.openrasp.jsoniter.output.ReflectionObjectEncoder.enocde(ReflectionObjectEncoder.java:78) at com.baidu.openrasp.jsoniter.output.ReflectionObjectEncoder.encode(ReflectionObjectEncoder.java:37) at com.baidu.openrasp.jsoniter.output.JsonStream.writeVal(JsonStream.java:362) at com.baidu.openrasp.jsoniter.output.ReflectionObjectEncoder.writeEncodeTo(ReflectionObjectEncoder.java:121) at com.baidu.openrasp.jsoniter.output.ReflectionObjectEncoder.enocde(ReflectionObjectEncoder.java:78) at com.baidu.openrasp.jsoniter.output.ReflectionObjectEncoder.encode(ReflectionObjectEncoder.java:37) at com.baidu.openrasp.jsoniter.output.JsonStream.writeVal(JsonStream.java:362) at com.baidu.openrasp.jsoniter.output.ReflectionObjectEncoder.writeEncodeTo(ReflectionObjectEncoder.java:121) at com.baidu.openrasp.jsoniter.output.ReflectionObjectEncoder.enocde_(ReflectionObjectEncoder.java:78) at com.baidu.openrasp.jsoniter.output.ReflectionObjectEncoder.encode(ReflectionObjectEncoder.java:37) at com.baidu.openrasp.jsoniter.output.JsonStream.writeVal(JsonStream.java:362) at com.baidu.openrasp.jsoniter.output.ReflectionObjectEncoder.writeEncodeTo(ReflectionObjectEncoder.java:121) ......

序列化进入死循环了,请问有类似的报错发生吗?有没有解决方案

MohammadEdris313 commented 4 months ago

Hey bro how to add issue on github