fastjson导致的程序崩溃:A fatal error has been detected by the Java Runtime Environment
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000001da4d3ab6b3, pid=15996, tid=0x0000000000006478
#
# JRE version: Java(TM) SE Runtime Environment (8.0_361) (build 1.8.0_361-b09)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.361-b09 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# J 3992 C1 com.alibaba.fastjson2.util.JDKUtils.getCharArray(Ljava/lang/String;)[C (33 bytes) @ 0x000001da4d3ab6b3 [0x000001da4d3ab680+0x33]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
'com/alibaba/fastjson2/JSONFactory$Utils'Compiled method (c1) 11739 3992 ! 1 com.alibaba.fastjson2.util.JDKUtils::getCharArray (33 bytes)
total in heap [0x000001da4d3ab510,0x000001da4d3aba50] = 1344
relocation [0x000001da4d3ab630,0x000001da4d3ab678] = 72
main code [0x000001da4d3ab680,0x000001da4d3ab880] = 512
stub code [0x000001da4d3ab880,0x000001da4d3ab930] = 176
oops [0x000001da4d3ab930,0x000001da4d3ab938] = 8
metadata [0x000001da4d3ab938,0x000001da4d3ab948] = 16
scopes data [0x000001da4d3ab948,0x000001da4d3ab9a8] = 96
scopes pcs [0x000001da4d3ab9a8,0x000001da4d3aba18] = 112
dependencies [0x000001da4d3aba18,0x000001da4d3aba20] = 8
handler table [0x000001da4d3aba20,0x000001da4d3aba38] = 24
nul chk table [0x000001da4d3aba38,0x000001da4d3aba50] = 24
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
#
Process finished with exit code 1
错误原因
在使用JSON.parseArray()的时候传入的值为null导致;
解决方法
在使用前进行空值判断
浙公网安备 33010602011771号