From 9f7a5068bb26f2760332c6e0bacec424e2edd47a Mon Sep 17 00:00:00 2001 From: Duarte Meneses Date: Thu, 18 Nov 2021 09:08:40 -0600 Subject: Improve code quality --- server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'server/sonar-db-core') 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 setStrings(PreparedStatement stmt, Supplier index) { + public static Consumer setStrings(PreparedStatement stmt, IntSupplier index) { return value -> { try { - stmt.setString(index.get(), value); + stmt.setString(index.getAsInt(), value); } catch (SQLException e) { Throwables.propagate(e); } -- cgit v1.2.3