From 616189880522636f435bbfd50441e79edc1b5fd0 Mon Sep 17 00:00:00 2001 From: VladimirEliTokarev Date: Sat, 12 Nov 2016 17:17:17 +0200 Subject: [PATCH] Changed the configuration parser The usage of \\z delimeter is mustable --- .../main/java/meerkat/voting/gui/configuration/Converter.java | 2 +- .../gui/configuration/VotingBoothConfigurationCreator.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/configuration/Converter.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/configuration/Converter.java index b802e80..957d889 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/configuration/Converter.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/configuration/Converter.java @@ -75,11 +75,11 @@ public class Converter { } VotingBoothConfiguration config = GetVotingBoothJsonConfiguration(configurationPath); - System.out.print("yeyyy"); ConvertJsonIntoBinaryFile(config, outputPath); } catch (Exception e) { System.out.println("Exception thrown: " + e + ", " + e.getMessage()); + e.printStackTrace(); } } diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/configuration/VotingBoothConfigurationCreator.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/configuration/VotingBoothConfigurationCreator.java index 6950cbb..f9695dd 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/configuration/VotingBoothConfigurationCreator.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/configuration/VotingBoothConfigurationCreator.java @@ -70,7 +70,7 @@ public class VotingBoothConfigurationCreator { * @throws JSONException will be thrown if the parsing will fail */ private JSONArray getJsonFromPath(String path) throws FileNotFoundException, JSONException { - String content = new Scanner(new File(path)).next(); + String content = new Scanner(new File(path)).useDelimiter("\\Z").next(); JSONObject jsonObject = new JSONObject(content); this.logger.debug("Created json object from from configuration path."); return (JSONArray)jsonObject.get("questions");