fastjson2
fastjson2 copied to clipboard
[BUG]JSON.parseArray转JSONObject,程序直接挂了
问题描述
简要描述您碰到的问题。
环境信息
请填写以下信息:
- OS信息: MacOS
- JDK信息:java version "1.8.0_361"
- 版本信息:Fastjson2 2.0.1
重现步骤
- 使用
static <T> List<T> parseArray(String str, Type itemType)
方法 - 输入
null
数据 - 出现程序直接挂掉的错误
data.getLeaveImageArray() 如果 leaveImageArray(String类型) 为null的情况下,调用 JSON.parseArray 方法
List<JSONObject> images = JSON.parseArray(data.getLeaveImageArray(), JSONObject.class);
期待的正确结果
对您期望发生的结果进行清晰简洁的描述。
相关日志输出
Stack: [0x000000030ec8c000,0x000000030ed8c000], sp=0x000000030ed8b340, free space=1020k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.dylib+0x579a50] Unsafe_GetObject+0x60 J 2923 sun.misc.Unsafe.getObject(Ljava/lang/Object;J)Ljava/lang/Object; (0 bytes) @ 0x000000010c3df13e [0x000000010c3df080+0xbe] j com.alibaba.fastjson2.util.JDKUtils.getCharArray(Ljava/lang/String;)[C+13 j com.alibaba.fastjson2.JSONReader.of(Ljava/lang/String;)Lcom/alibaba/fastjson2/JSONReader;+96 j com.alibaba.fastjson2.JSON.parseArray(Ljava/lang/String;Ljava/lang/reflect/Type;)Ljava/util/List;+20 j com.ydt.share.mq.CarOutConsumer.onMessage(Lcom/ydt/core/rocketmq/enums/RocketmqMsg;)V+147 j com.ydt.share.mq.CarOutConsumer.onMessage(Ljava/lang/Object;)V+5 j org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer.handleMessage(Lorg/apache/rocketmq/common/message/MessageExt;)V+16 j org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer.access$100(Lorg/apache/rocketmq/spring/support/DefaultRocketMQListenerContainer;Lorg/apache/rocketmq/common/message/MessageExt;)V+2 j org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer$DefaultMessageListenerConcurrently.consumeMessage(Ljava/util/List;Lorg/apache/rocketmq/client/consumer/listener/ConsumeConcurrentlyContext;)Lorg/apache/rocketmq/client/consumer/listener/ConsumeConcurrentlyStatus;+50 j org.apache.rocketmq.client.impl.consumer.ConsumeMessageConcurrentlyService$ConsumeRequest.run()V+290 j java.util.concurrent.Executors$RunnableAdapter.call()Ljava/lang/Object;+4 j java.util.concurrent.FutureTask.run$$$capture()V+42 j java.util.concurrent.FutureTask.run()V+5 j java.util.concurrent.ThreadPoolExecutor.runWorker(Ljava/util/concurrent/ThreadPoolExecutor$Worker;)V+95 j java.util.concurrent.ThreadPoolExecutor$Worker.run()V+5 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub V [libjvm.dylib+0x2d858b] JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*)+0x689 V [libjvm.dylib+0x2d73ee] JavaCalls::call_virtual(JavaValue*, KlassHandle, Symbol*, Symbol*, JavaCallArguments*, Thread*)+0x14a V [libjvm.dylib+0x2d75cf] JavaCalls::call_virtual(JavaValue*, Handle, KlassHandle, Symbol*, Symbol*, Thread*)+0x57 V [libjvm.dylib+0x3447f3] thread_entry(JavaThread*, Thread*)+0x78 V [libjvm.dylib+0x562bd0] JavaThread::thread_main_inner()+0x82 V [libjvm.dylib+0x562a8f] JavaThread::run()+0x19d V [libjvm.dylib+0x48fb3b] java_start(Thread*)+0xfa C [libsystem_pthread.dylib+0x6259] _pthread_start+0x7d C [libsystem_pthread.dylib+0x1c7b] thread_start+0xf C 0x0000000000000000
附加信息
如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。