【问题标题】:sonarqube 6.3 error could-not-complete-symbolic-execution-reached-limit-of-16000 stepssonarqube 6.3 错误无法完成符号执行达到 16000 步的限制
【发布时间】:2017-08-28 14:47:03
【问题描述】:

我们的扫描在下面的代码中中止,但有以下例外:

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

我们查看了规则 S2259 和 S2583,并希望保留有关空指针的通知。

这在“常规”和调试 (-X) 模式下都会发生,因此不是问题 1406。在我们的例子中,它似乎与 try/catch 相关。 (请参见下面的示例方法。)这可能是问题 1295 的复兴吗? https://jira.sonarsource.com/browse/SONARJAVA-1295 如果是这样,有没有办法简单地将堆栈从 16,000 增加到我们可以继续前进?

示例方法:

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

【问题讨论】:

    标签: java sonarqube try-catch-finally


    【解决方案1】:

    6.3 及更高版本需要 Oracle Java 8。我们的公共 Java 7 似乎是最有可能的罪魁祸首。实际原因可能是其他原因,但升级修复了它。

    【讨论】:

      猜你喜欢
      • 2017-06-16
      • 2016-03-08
      • 1970-01-01
      • 2016-08-14
      • 1970-01-01
      • 1970-01-01
      • 2018-03-02
      • 2015-09-03
      • 2013-05-07
      相关资源
      最近更新 更多