我们有一个扫描在下面的代码中止,但例外:
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;
}
答案 0 :(得分:0)
6.3及更高版本需要Oracle Java 8.我们的公共Java 7似乎是最可能的罪魁祸首。实际原因可能是其他原因,但升级修复了它。