diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2021-11-18 09:08:40 -0600 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2021-11-18 20:03:33 +0000 |
commit | 9f7a5068bb26f2760332c6e0bacec424e2edd47a (patch) | |
tree | 51ff128c6f77d1d15db5abe7960a90c74ee3d783 /server/sonar-db-core | |
parent | eda9dff59cc60209b15b69ef4aa4c18885c0c744 (diff) | |
download | sonarqube-9f7a5068bb26f2760332c6e0bacec424e2edd47a.tar.gz sonarqube-9f7a5068bb26f2760332c6e0bacec424e2edd47a.zip |
Improve code quality
Diffstat (limited to 'server/sonar-db-core')
-rw-r--r-- | server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java b/server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java index d170870b844..4a74e8771a3 100644 --- a/server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java +++ b/server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java @@ -43,6 +43,7 @@ import java.util.Optional; import java.util.Set; import java.util.function.Consumer; import java.util.function.IntFunction; +import java.util.function.IntSupplier; import java.util.function.Supplier; import java.util.regex.Pattern; import javax.annotation.CheckForNull; @@ -440,10 +441,10 @@ public class DatabaseUtils { /** * This method can be used as a method reference, for not to have to handle the checked exception {@link SQLException} */ - public static Consumer<String> setStrings(PreparedStatement stmt, Supplier<Integer> index) { + public static Consumer<String> setStrings(PreparedStatement stmt, IntSupplier index) { return value -> { try { - stmt.setString(index.get(), value); + stmt.setString(index.getAsInt(), value); } catch (SQLException e) { Throwables.propagate(e); } |