I have the following piece of code in my program and I am running SonarQube for code quality check on it after integrating it with Maven.
However, Sonar is complaining that I should Either log or rethrow this exception.
What am I missing here? Am I not already logging the exception?
public AccountResponse getAccountStatus(AccessIDSearchResponse accessIDResponse) {
accountResponse = null;
try {
AccountRequest request = new AccountRequest();
} catch (ServiceException serviceException) {
log.error("getAccountStatus-GotServiceException =" + ExceptionUtils.getStackTrace(serviceException));
throw serviceException;
} catch (Exception e) {
throw new ServiceException(ErrorMessages.EPO_SYSTEM_ERROR, e.getMessage());
}
return accountResponse;
}