Fixes bug on Remote Fetcher when "source" field is null.
This commit is contained in:
parent
99d3ec9998
commit
1c9d631fcd
|
@ -190,11 +190,20 @@ public class RemoteFetcher {
|
|||
if (responseCode == HttpURLConnection.HTTP_OK) { // success
|
||||
//do here all the parsing
|
||||
DocumentContext jsonContext = JsonPath.parse(con.getInputStream());
|
||||
Results results = new Results(jsonContext.read(jsonDataPath.getPath()
|
||||
+ "[" + jsonDataPath.getFieldsUrlConfiguration().getName() + "," + jsonDataPath.getFieldsUrlConfiguration().getDescription()
|
||||
+ "," + jsonDataPath.getFieldsUrlConfiguration().getUri() + "," + jsonDataPath.getFieldsUrlConfiguration().getId()
|
||||
+ "," + jsonDataPath.getFieldsUrlConfiguration().getSource() + "]"),
|
||||
jsonContext.read(jsonPaginationPath));
|
||||
Results results;
|
||||
if (jsonDataPath.getFieldsUrlConfiguration().getSource() != null) {
|
||||
results = new Results(jsonContext.read(jsonDataPath.getPath()
|
||||
+ "[" + jsonDataPath.getFieldsUrlConfiguration().getName() + "," + jsonDataPath.getFieldsUrlConfiguration().getDescription()
|
||||
+ "," + jsonDataPath.getFieldsUrlConfiguration().getUri() + "," + jsonDataPath.getFieldsUrlConfiguration().getId()
|
||||
+ "," + jsonDataPath.getFieldsUrlConfiguration().getSource() + "]"),
|
||||
jsonContext.read(jsonPaginationPath));
|
||||
}
|
||||
else {
|
||||
results = new Results(jsonContext.read(jsonDataPath.getPath()
|
||||
+ "[" + jsonDataPath.getFieldsUrlConfiguration().getName() + "," + jsonDataPath.getFieldsUrlConfiguration().getDescription()
|
||||
+ "," + jsonDataPath.getFieldsUrlConfiguration().getUri() + "," + jsonDataPath.getFieldsUrlConfiguration().getId() + "]"),
|
||||
jsonContext.read(jsonPaginationPath));
|
||||
}
|
||||
results.results = results.results.stream().map(e -> e.entrySet().stream().collect(Collectors.toMap(x -> this.transformKey(jsonDataPath,x.getKey()), Map.Entry::getValue)))
|
||||
.collect(Collectors.toList());
|
||||
return results;
|
||||
|
|
Loading…
Reference in New Issue