Revision 60481
Added by Konstantina Galouni about 3 years ago
UserTokensController.java | ||
---|---|---|
107 | 107 |
} |
108 | 108 |
|
109 | 109 |
@RequestMapping(value = "/orcid/personal-details", method = RequestMethod.GET) |
110 |
public String getPersonalDetailsFromOrcid() throws BadPaddingException, InvalidKeyException, NoSuchAlgorithmException, IllegalBlockSizeException, IOException, NoSuchPaddingException, InvalidAlgorithmParameterException, InvalidKeySpecException {
|
|
110 |
public String getPersonalDetailsFromOrcid() throws Exception { |
|
111 | 111 |
log.debug("getPersonalDetailsFromOrcid"); |
112 | 112 |
|
113 | 113 |
UserTokens userTokens = userTokensService.getUserTokens(); |
... | ... | |
144 | 144 |
if (response.getStatusCode() != HttpStatus.OK) { |
145 | 145 |
orcid_log.error("Getting user details response code is: " + response.getStatusCode()); |
146 | 146 |
orcid_log.error("Unexpected Response: "+response.getBody()); |
147 |
return null; |
|
147 |
|
|
148 |
if(response.getStatusCode() == HttpStatus.UNAUTHORIZED) { |
|
149 |
throw new AuthorizationServiceException("You are not allowed to get personal details"); |
|
150 |
} else { |
|
151 |
throw new Exception("Internal server error"); |
|
152 |
} |
|
153 |
// return null; |
|
148 | 154 |
} else { |
149 | 155 |
orcid_log.info("response: "+response); |
150 | 156 |
return response.getBody().toString(); |
Also available in: Unified diff
[Trunk | Orcid Service]: UserTokensController.java: In "getPersonalDetailsFromOrcid()" method (/orcid/personal-details), when getting error response from ORCID API, throw Exception.