Fix JSON parser function
This commit is contained in:
parent
c61932d99d
commit
2cb004c6d0
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue