From cbe291b6aff0884c2dfe1ce2ac38ef0a8222092c Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Thu, 22 Jan 2015 18:09:04 +0100 Subject: [PATCH] Missing close of ResultSet in AnalysisReportDao (even if it's not supposed to be needed as RS is closed by Statement) --- .../org/sonar/server/computation/db/AnalysisReportDao.java | 3 ++- .../org/sonar/server/computation/issue/RuleCacheLoader.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/db/AnalysisReportDao.java b/server/sonar-server/src/main/java/org/sonar/server/computation/db/AnalysisReportDao.java index d1778622f60..ea34aa81760 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/db/AnalysisReportDao.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/db/AnalysisReportDao.java @@ -156,7 +156,7 @@ public class AnalysisReportDao implements DaoComponent { Connection connection = session.getConnection(); InputStream stream = null; PreparedStatement ps = null; - ResultSet rs; + ResultSet rs = null; try { ps = connection.prepareStatement("select report_data from analysis_reports where id=?"); ps.setLong(1, id); @@ -175,6 +175,7 @@ public class AnalysisReportDao implements DaoComponent { throw new IllegalStateException(String.format("Failed to decompress report '%d'", id), e); } finally { IOUtils.closeQuietly(stream); + DatabaseUtils.closeQuietly(rs); DatabaseUtils.closeQuietly(ps); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/issue/RuleCacheLoader.java b/server/sonar-server/src/main/java/org/sonar/server/computation/issue/RuleCacheLoader.java index c6936344a6c..e6439fd5baa 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/issue/RuleCacheLoader.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/issue/RuleCacheLoader.java @@ -21,6 +21,7 @@ package org.sonar.server.computation.issue; import org.sonar.api.rule.RuleKey; import org.sonar.core.persistence.DbSession; +import org.sonar.core.persistence.MyBatis; import org.sonar.core.rule.RuleDto; import org.sonar.server.db.DbClient; import org.sonar.server.util.cache.CacheLoader; @@ -42,7 +43,7 @@ public class RuleCacheLoader implements CacheLoader { try { return dbClient.ruleDao().getNullableByKey(session, key); } finally { - session.close(); + MyBatis.closeQuietly(session); } } -- 2.39.5