Changeset 6010
- Timestamp:
- 02/23/15 11:00:15 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/trunk/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/service/handle/impl/HandleRestApiClient.java
r4983 r6010 33 33 * Service that connects to the handle.net REST API and retrieves the URL for a 34 34 * given handle. 35 * 35 * 36 36 * Consider re-implementing using the handle API 37 37 * … … 99 99 // The handle API returns a JSON structure with a number of handle 100 100 // record fields. We are only interested in the value at 101 // values[x].data where values[x].type == 'URL'101 // values[x].data.value where values[x].type == 'URL' 102 102 103 103 final JSONObject jsonResponse = new JSONObject(jsonString); … … 106 106 final JSONObject object = valuesArray.getJSONObject(i); 107 107 final String type = object.getString("type"); 108 if ("URL".equals(type)) { 109 // the field we were looking for 110 return object.getString("data"); 108 if ("URL".equals(type) && object.has("data")) { 109 final JSONObject data = object.getJSONObject("data"); 110 if (data.has("value")) { 111 // the field we were looking for 112 return data.getString("value"); 113 } 111 114 } 112 115 }
Note: See TracChangeset
for help on using the changeset viewer.