Revision 60621
Added by Konstantina Galouni about 3 years ago
WorkController.java | ||
---|---|---|
186 | 186 |
|
187 | 187 |
@RequestMapping(value = "/orcid/work/update/{putCode}", method = RequestMethod.POST) |
188 | 188 |
public Work updateWork(@PathVariable String putCode, |
189 |
@RequestBody String resultString) throws AccessDeniedException, BadPaddingException, InvalidKeyException, NoSuchAlgorithmException, IllegalBlockSizeException, IOException, NoSuchPaddingException, InvalidAlgorithmParameterException, InvalidKeySpecException {
|
|
189 |
@RequestBody String resultString) throws Exception { |
|
190 | 190 |
log.debug("updateWork: putCode = " + putCode); |
191 | 191 |
|
192 | 192 |
Gson gson = new GsonBuilder().create(); |
... | ... | |
229 | 229 |
if (response.getStatusCode() != HttpStatus.OK) { |
230 | 230 |
orcid_log.error("Updating work response code is: " + response.getStatusCode()); |
231 | 231 |
orcid_log.error("Unexpected Response: "+response.getBody()); |
232 |
return null; |
|
232 |
|
|
233 |
if(response.getStatusCode() == HttpStatus.UNAUTHORIZED) { |
|
234 |
throw new AuthorizationServiceException("You are not allowed to update work"); |
|
235 |
} else if(response.getStatusCode() == HttpStatus.CONFLICT) { |
|
236 |
throw new ConflictException("Work is already saved"); |
|
237 |
} else { |
|
238 |
throw new Exception("Internal server error"); |
|
239 |
} |
|
240 |
// return null; |
|
233 | 241 |
} else { |
234 | 242 |
orcid_log.info("Response: "+response); |
235 | 243 |
Date date = new Date(); |
Also available in: Unified diff
[Trunk | Orcid Service]:
1, WorkController.java: In method "updateWork()" (/orcid/work/update/{putCode}), if ORCID does not return HttpStatus.OK,
return AuthorizationServiceException (for HttpStatus.UNAUTHORIZED), ConflictException (for HttpStatus.CONFLICT) or Exception instead of null.