JAMES-2578 Reuse FST Json configuration
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/94df1ac4 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/94df1ac4 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/94df1ac4 Branch: refs/heads/master Commit: 94df1ac4536a5004637c49a6e3038082e7f2489e Parents: d66fa22 Author: Benoit Tellier <btell...@linagora.com> Authored: Tue Oct 30 09:08:55 2018 +0700 Committer: Benoit Tellier <btell...@linagora.com> Committed: Thu Nov 1 11:03:32 2018 +0700 ---------------------------------------------------------------------- mailet/api/src/main/java/org/apache/mailet/Serializer.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/94df1ac4/mailet/api/src/main/java/org/apache/mailet/Serializer.java ---------------------------------------------------------------------- diff --git a/mailet/api/src/main/java/org/apache/mailet/Serializer.java b/mailet/api/src/main/java/org/apache/mailet/Serializer.java index e3eb47a..ffa0069 100644 --- a/mailet/api/src/main/java/org/apache/mailet/Serializer.java +++ b/mailet/api/src/main/java/org/apache/mailet/Serializer.java @@ -442,8 +442,7 @@ public interface Serializer<T> { @Override public JsonNode serialize(Serializable object) { - FSTConfiguration conf = CONFIGURATION; - String json = conf.asJsonString(object); + String json = CONFIGURATION.asJsonString(object); try { return new ObjectMapper().reader().readTree(json); } catch (IOException e) { @@ -453,9 +452,8 @@ public interface Serializer<T> { @Override public Optional<Serializable> deserialize(JsonNode json) { - FSTConfiguration conf = FSTConfiguration.createJsonConfiguration(); try { - return Optional.of((Serializable) conf.asObject(new ObjectMapper().writer().writeValueAsBytes(json))); + return Optional.of((Serializable) CONFIGURATION.asObject(new ObjectMapper().writer().writeValueAsBytes(json))); } catch (JsonProcessingException e) { throw new UncheckedIOException(e); } --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org