Changed the configuration parser

The usage of \\z delimeter is mustable
android-scanner
VladimirEliTokarev 2016-11-12 17:17:17 +02:00
parent 7b937cc754
commit 6161898805
2 changed files with 2 additions and 2 deletions

View File

@ -75,11 +75,11 @@ public class Converter {
} }
VotingBoothConfiguration config = GetVotingBoothJsonConfiguration(configurationPath); VotingBoothConfiguration config = GetVotingBoothJsonConfiguration(configurationPath);
System.out.print("yeyyy");
ConvertJsonIntoBinaryFile(config, outputPath); ConvertJsonIntoBinaryFile(config, outputPath);
} }
catch (Exception e) { catch (Exception e) {
System.out.println("Exception thrown: " + e + ", " + e.getMessage()); System.out.println("Exception thrown: " + e + ", " + e.getMessage());
e.printStackTrace();
} }
} }

View File

@ -70,7 +70,7 @@ public class VotingBoothConfigurationCreator {
* @throws JSONException will be thrown if the parsing will fail * @throws JSONException will be thrown if the parsing will fail
*/ */
private JSONArray getJsonFromPath(String path) throws FileNotFoundException, JSONException { 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); JSONObject jsonObject = new JSONObject(content);
this.logger.debug("Created json object from from configuration path."); this.logger.debug("Created json object from from configuration path.");
return (JSONArray)jsonObject.get("questions"); return (JSONArray)jsonObject.get("questions");