sonarqube 6.3 error could-not-complete-symbolic-execution-reached-limit-of-16000 steps

泄露秘密 提交于 2021-02-20 18:47:14

问题


We have a scan that aborts on the code below, with the exception:

org.sonar.java.se.ExplodedGraphWalker$MaximumStepsReachedException: reached limit of 16000 steps for method getServiceProviders#151 in class ServiceProviderService

We looked at rules S2259 and S2583 and would like to keep notifications about null pointers.

This happens in both "regular" and debug (-X) mode, so it's not issue 1406. In our case it really seems to be related to try/catch. (See sample method below.) Could it be a resurgence of issue 1295? https://jira.sonarsource.com/browse/SONARJAVA-1295 If so, is there a way to simply increase the stack from 16,000 so that we can move along?

SAMPLE METHOD:

public static List<ServiceProvider> getServiceProviders() throws DAOException {
    Connection con = null;
    PreparedStatement stmt = null;
    ResultSet rs = null;
    List<ServiceProvider> serviceProviderList = new ArrayList<>();

    try {
        con = DatabaseUtils.getConnection();
        if (con != null) {
            stmt = con.prepareStatement(sqlSelectServiceProviders);

            rs = stmt.executeQuery();
            while (rs.next()) {
                ServiceProvider serviceProvider = new ServiceProvider();
                serviceProvider.setId(rs.getLong(1));
                serviceProvider.setName(rs.getString(2));
                // etc.
                serviceProviderList.add(serviceProvider);
            }   
        } else {
            DAOException ourDAOException = new DAOException();
            ourDAOException.setMessageCode(Consts.ERROR_CANNOT_ESTABLISH_CONNECTIONS);
            throw ourDAOException;
        }   
    } catch (DAOException daoexcep) {
        throw daoexcep;

    } catch (Exception sqlex) {
        log.error(ErrorType.SYSTEM + ": " + Consts.ERROR_CANNOT_GET_SERVICE_PROVIDER + " - " + sqlex);
        log.error(sqlex);
        try {
            if (con != null) {
                con.rollback();
            }   
        } catch (SQLException ex) {
        }   
        DAOException ourDAOException = new DAOException(sqlex);
        ourDAOException.setMessageCode(Consts.ERROR_CANNOT_GET_SERVICE_PROVIDER);
        throw ourDAOException;
    } finally {
        if (con != null) {
            try {
                con.close();
            } catch (SQLException e) {
            }   
            con = null;
        }   
    }   
    return serviceProviderList;
}   

回答1:


6.3 and later require Oracle Java 8. Our public Java 7 seems to be the most likely culprit. The actual cause might have been something else, but the upgrade fixed it.



来源:https://stackoverflow.com/questions/43189650/sonarqube-6-3-error-could-not-complete-symbolic-execution-reached-limit-of-16000

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!