Java – sonarqube 6.3 error unable to complete – symbol – execute – reach – limit – 16000 steps

We have a scan aborted in the following code, 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 wanted to keep notifications about null pointers

This happens in both "normal" and debug (- x) modes, so it's not a problem 1406 In our example, it seems to be related to try / catch (see the example method below.) Could this be the recovery of question 1295? https://jira.sonarsource.com/browse/SONARJAVA-1295 If so, is there a way to simply increase the stack from 16000 so that we can move on?

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

Solution

6.3 and later require Oracle Java 8.0 Our public Java 7 seems to be the most likely culprit The actual reason may be other reasons, but the upgrade fixes it

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>