From 15bfc3f32f7d26b9b1fdf2ce2a4ca214deb41e2d Mon Sep 17 00:00:00 2001 From: aiceflower Date: Thu, 9 Jan 2025 09:57:44 +0800 Subject: [PATCH] fix toInt error --- .../org/apache/linkis/storage/domain/MethodEntity.scala | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/domain/MethodEntity.scala b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/domain/MethodEntity.scala index fac0a2d01b..a9aa406e1b 100644 --- a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/domain/MethodEntity.scala +++ b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/domain/MethodEntity.scala @@ -18,8 +18,7 @@ package org.apache.linkis.storage.domain import java.lang.reflect.Type - -import com.google.gson.GsonBuilder +import com.google.gson.{GsonBuilder, ToNumberPolicy} /** * @param id @@ -56,7 +55,10 @@ case class MethodEntity( object MethodEntitySerializer { - val gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").create + val gson = new GsonBuilder() + .setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ") + .setObjectToNumberStrategy(ToNumberPolicy.LAZILY_PARSED_NUMBER) + .create /** * Serialized to code as a MethodEntity object 序列化为code为MethodEntity对象