首页 > 解决方案 > 抱怨在声纳中记录和重新抛出异常

问题描述

我的程序中有以下代码,在将其与 Maven 集成后,我正在运行 SonarQube 以对其进行代码质量检查。

但是,Sonar 抱怨我应该记录或重新抛出此异常。

我在这里想念什么?我还没有记录异常吗?

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;
}

在此处输入图像描述

标签: javasonarlint

解决方案


推荐阅读