Need improved exception handling for different scenarios
At present Not Found exceptions are thrown without checking the actual error codes e.g
public Boolean checkAndRegisterSystemAuthorityIfNotPresent(String authorityId) {
try {
Authority authority = new Authority();
authority.setAuthorityId(authorityId);
authorityStore.createSystemAuthority(authority);
} catch (ApplicationException e) {
return false;
} catch (BadRequestException ex) {
return true;
}
There should be check for specific error code: eg.
BadRequestException(MessageFormat.format(SchemaConstants.AUTHORITY_EXISTS_EXCEPTION,
authority.getAuthorityId()));