(even if it's not supposed to be needed as RS is closed by Statement)
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);
throw new IllegalStateException(String.format("Failed to decompress report '%d'", id), e);
} finally {
IOUtils.closeQuietly(stream);
+ DatabaseUtils.closeQuietly(rs);
DatabaseUtils.closeQuietly(ps);
}
}
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;
try {
return dbClient.ruleDao().getNullableByKey(session, key);
} finally {
- session.close();
+ MyBatis.closeQuietly(session);
}
}