Correctly checking return type of POST method
This commit is contained in:
parent
2fbf8478d7
commit
6d6b70f87b
|
@ -565,22 +565,17 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
|
||||
HttpEntity<String> httpEntity = new HttpEntity <> (json_interface,httpHeaders);
|
||||
|
||||
restTemplate.postForObject(uriComponents.toUri(),httpEntity, String.class);
|
||||
|
||||
ResponseEntity responseEntity = restTemplate.postForObject(uriComponents.toUri(),httpEntity,ResponseEntity.class);
|
||||
emailUtils.sendAdminRegisterInterfaceEmail(e, comment, repositoryInterface, SecurityContextHolder.getContext().getAuthentication());
|
||||
emailUtils.sendUserRegisterInterfaceEmail(e, comment, repositoryInterface, SecurityContextHolder.getContext().getAuthentication());
|
||||
|
||||
if (responseEntity.getStatusCode().equals(HttpStatus.OK)) {
|
||||
emailUtils.sendAdminRegisterInterfaceEmail(e, comment, repositoryInterface, SecurityContextHolder.getContext().getAuthentication());
|
||||
emailUtils.sendUserRegisterInterfaceEmail(e, comment, repositoryInterface, SecurityContextHolder.getContext().getAuthentication());
|
||||
submitInterfaceValidation(e, registeredBy, repositoryInterface, false);
|
||||
|
||||
submitInterfaceValidation(e, registeredBy, repositoryInterface, false);
|
||||
return repositoryInterface;
|
||||
} else {
|
||||
LOGGER.debug(responseEntity.getBody().toString());
|
||||
throw new Exception("Registering" + baseAddress + " returned " + responseEntity.getStatusCode());
|
||||
}
|
||||
return repositoryInterface;
|
||||
|
||||
} catch (JSONException | ValidatorServiceException e) {
|
||||
LOGGER.debug("Exception on addRepositoryInterface" , e);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Exception on addRepositoryInterface" , e);
|
||||
emailUtils.reportException(e);
|
||||
throw e;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue