From: Daniel Kirschten Date: Mon, 16 Sep 2019 15:48:16 +0000 (+0200) Subject: Removed legacy version line handling from JsonHandler for speedup X-Git-Url: https://mograsim.net/gitweb/?a=commitdiff_plain;h=c862a8536d9167bef6cfaba850b65fc93513d1b0;p=Mograsim.git Removed legacy version line handling from JsonHandler for speedup --- diff --git a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/util/JsonHandler.java b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/util/JsonHandler.java index d2d6de31..950b9532 100644 --- a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/util/JsonHandler.java +++ b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/util/JsonHandler.java @@ -39,14 +39,7 @@ public class JsonHandler public static T fromJson(String src, Class type) { - // throw away legacy version line, but keep line numbers - int linesBeforeJsonStart = (int) src.lines().takeWhile(s -> s.length() == 0 || s.charAt(0) != '{').count(); - String rawJson; - if (linesBeforeJsonStart == 0) - rawJson = src; - else - rawJson = "\n".repeat(linesBeforeJsonStart) + src.lines().skip(linesBeforeJsonStart).collect(Collectors.joining("\n")); - return parser.fromJson(rawJson, type); + return parser.fromJson(src, type); } public static T fromJsonTree(JsonElement src, Class type)