diff options
Diffstat (limited to 'controlloop/common/model-impl/appc')
-rw-r--r-- | controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java index 8a801c32b..be7a66ada 100644 --- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java +++ b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java @@ -25,6 +25,9 @@ import java.time.Instant; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonDeserializationContext; @@ -37,16 +40,17 @@ import com.google.gson.JsonSerializer; public final class Serialization { - public static DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSSxxx"); + public static final DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSSxxx"); public static class gsonUTCAdapter implements JsonSerializer<ZonedDateTime>, JsonDeserializer<ZonedDateTime> { - + private static final Logger logger = LoggerFactory.getLogger(gsonUTCAdapter.class); + public ZonedDateTime deserialize(JsonElement element, Type type, JsonDeserializationContext context) throws JsonParseException { try { return ZonedDateTime.parse(element.getAsString(), format); } catch (Exception e) { - System.err.println(e); + logger.error("deserialize threw: ", e); } return null; } |