Fix JSON parser function

This commit is contained in:
2021-01-10 19:53:09 +01:00
parent c61932d99d
commit 2cb004c6d0

View File

@@ -45,10 +45,13 @@ public class Indexer {
JSONArray parseJSONFile(String filePath) throws IOException, ParseException {
InputStream jsonFile = getClass().getResourceAsStream(filePath);
JSONArray parseJSONFile(File file) throws IOException {
InputStream jsonFile = new FileInputStream(file);
Reader readerJson = new InputStreamReader(jsonFile);
Object fileObjects = JSONValue.parse(readerJson);
JSONArray arrayObjects = (JSONArray) fileObjects;
return arrayObjects;
Object fileObject = JSONValue.parse(readerJson);
JSONArray arrayObject = new JSONArray();
arrayObject.add(fileObject);
return arrayObject;
}
void openIndex() throws IOException {