diff --git a/src/main/java/club/joylink/xiannccda/configuration/JsonConfig.java b/src/main/java/club/joylink/xiannccda/configuration/JsonConfig.java index b1894b5..7f2c4dc 100644 --- a/src/main/java/club/joylink/xiannccda/configuration/JsonConfig.java +++ b/src/main/java/club/joylink/xiannccda/configuration/JsonConfig.java @@ -10,6 +10,7 @@ import com.alibaba.fastjson2.writer.ObjectWriter; import java.lang.reflect.Type; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; +import org.apache.commons.lang3.StringUtils; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; import org.springframework.boot.autoconfigure.http.HttpMessageConverters; @@ -47,6 +48,9 @@ public class JsonConfig implements ApplicationRunner { public LocalDateTime readObject(JSONReader jsonReader, Type fieldType, Object fieldName, long features) { String str = jsonReader.readString(); + if (StringUtils.isEmpty(str)) { + return null; + } return LocalDateTime.parse(str, DATE_TIME_FORMATTER); } });