diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2019-06-28 17:28:00 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2019-06-30 20:21:05 +0200 |
commit | 2b2cc62ebbf22c8d6eab7b7c026d60afadae4bee (patch) | |
tree | 0148a3d2b1542582ff20a573b33dc2f71b5e92e1 | |
parent | 1cd9ed7740edcd86e2cfb817f05485ae3e11a721 (diff) | |
download | sonarqube-2b2cc62ebbf22c8d6eab7b7c026d60afadae4bee.tar.gz sonarqube-2b2cc62ebbf22c8d6eab7b7c026d60afadae4bee.zip |
SONAR-12251 fix statement leak in DB migrations
Signed-off-by: Simon Brandhof <simon.brandhof@sonarsource.com>
-rw-r--r-- | server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/MassUpdate.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/MassUpdate.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/MassUpdate.java index 34547ce1fe7..b9f9bc402f1 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/MassUpdate.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/MassUpdate.java @@ -90,7 +90,7 @@ public class MassUpdate { progress.start(); try { select.scroll(row -> callSingleHandler(handler, updates.iterator().next(), row)); - closeUpdates(); + closeStatements(); // log the total number of processed rows progress.log(); @@ -105,7 +105,7 @@ public class MassUpdate { progress.start(); try { select.scroll(row -> callMultiHandler(handler, updates, row)); - closeUpdates(); + closeStatements(); // log the total number of processed rows progress.log(); @@ -132,13 +132,14 @@ public class MassUpdate { counter.getAndIncrement(); } - private void closeUpdates() throws SQLException { + private void closeStatements() throws SQLException { for (UpsertImpl update : updates) { if (update.getBatchCount() > 0L) { update.execute().commit(); } update.close(); } + select.close(); } } |