Removed legacy version line handling from JsonHandler for speedup
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Mon, 16 Sep 2019 15:48:16 +0000 (17:48 +0200)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Mon, 16 Sep 2019 15:48:16 +0000 (17:48 +0200)
plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/util/JsonHandler.java

index d2d6de3..950b953 100644 (file)
@@ -39,14 +39,7 @@ public class JsonHandler
 
        public static <T> T fromJson(String src, Class<T> 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> T fromJsonTree(JsonElement src, Class<T> type)