Skip to content

Commit

Permalink
Bugfix: Some DOIs are missing fields
Browse files Browse the repository at this point in the history
Make sure to check if the fields (i.e. volume, etc)
appear otherwise set it to empty string.
  • Loading branch information
timeu committed Jun 21, 2020
1 parent bc026ff commit 9d9478a
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,11 @@ public void onResponseReceived(Request request, Response response) {
if (response.getStatusCode() == 200) {
try {
JSONObject object = JSONParser.parseStrict(response.getText()).isObject();
String volume = object.get("volume").isString().stringValue();
String volume = object.containsKey("volume") ? object.get("volume").isString().stringValue() :"";
final String DOI = object.get("DOI").isString().stringValue();
String URL = object.get("URL").isString().stringValue();
String page = object.get("page").isString().stringValue();
String issue = object.get("issue").isString().stringValue();
String page = object.containsKey("page") ? object.get("page").isString().stringValue(): "";
String issue = object.containsKey("issue") ? object.get("issue").isString().stringValue(): "";
String title = object.get("title").isString().stringValue();
String journal = object.get("container-title").isString().stringValue();
JSONObject authorObj = object.get("author").isArray().get(0).isObject();
Expand Down

0 comments on commit 9d9478a

Please sign in to comment.