From 204198f1435d6b44cf8209df93e00da08cdb6317 Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Mon, 12 Feb 2024 20:40:44 +0100 Subject: [PATCH] Remove deprecated method and remove redundant cast or throws declaration --- .../main/java/fr/altarik/toolbox/core/config/ConfigI.java | 1 + Core/src/test/java/BuilderImpl.java | 2 +- Core/src/test/java/ConfigITest.java | 2 +- .../fr/altarik/toolbox/database/AbstractSqlConnection.java | 7 ------- .../java/fr/altarik/toolbox/database/SqlConnection.java | 6 ------ 5 files changed, 3 insertions(+), 15 deletions(-) diff --git a/Core/src/main/java/fr/altarik/toolbox/core/config/ConfigI.java b/Core/src/main/java/fr/altarik/toolbox/core/config/ConfigI.java index 6262667..3ca8aba 100644 --- a/Core/src/main/java/fr/altarik/toolbox/core/config/ConfigI.java +++ b/Core/src/main/java/fr/altarik/toolbox/core/config/ConfigI.java @@ -58,6 +58,7 @@ public class ConfigI { Files.writeString(this.configPath, GSON.toJson(this)); // Files.copy(tempPath, this.configPath, StandardCopyOption.REPLACE_EXISTING); // Files.delete(tempPath); + // commented because throws an error on windows each time if the file already exist } } diff --git a/Core/src/test/java/BuilderImpl.java b/Core/src/test/java/BuilderImpl.java index a5a8850..fdc1f76 100644 --- a/Core/src/test/java/BuilderImpl.java +++ b/Core/src/test/java/BuilderImpl.java @@ -32,7 +32,7 @@ public class BuilderImpl implements IBuilder { @Override - public BuilderResult build() throws Exception { + public BuilderResult build() { return new BuilderResult(collection.get(), numberOfSentences.get()); } } diff --git a/Core/src/test/java/ConfigITest.java b/Core/src/test/java/ConfigITest.java index c2280d3..6ece3ce 100644 --- a/Core/src/test/java/ConfigITest.java +++ b/Core/src/test/java/ConfigITest.java @@ -14,7 +14,7 @@ public class ConfigITest { public double para3 = 3.14; public static ConfigClazz load() throws IOException { - return (ConfigClazz) load(Path.of("."), "test.json", ConfigClazz.class); + return load(Path.of("."), "test.json", ConfigClazz.class); } } diff --git a/Database/src/main/java/fr/altarik/toolbox/database/AbstractSqlConnection.java b/Database/src/main/java/fr/altarik/toolbox/database/AbstractSqlConnection.java index e2a4c15..44d268a 100644 --- a/Database/src/main/java/fr/altarik/toolbox/database/AbstractSqlConnection.java +++ b/Database/src/main/java/fr/altarik/toolbox/database/AbstractSqlConnection.java @@ -25,13 +25,6 @@ public abstract class AbstractSqlConnection implements SqlConnection { return connection; } - @Override - public void closeConnection() { - try { - close(); - } catch (Exception ignored) {} - } - @Override public void close() throws Exception { if(!connection.isClosed()) { diff --git a/Database/src/main/java/fr/altarik/toolbox/database/SqlConnection.java b/Database/src/main/java/fr/altarik/toolbox/database/SqlConnection.java index a2839d7..438d149 100644 --- a/Database/src/main/java/fr/altarik/toolbox/database/SqlConnection.java +++ b/Database/src/main/java/fr/altarik/toolbox/database/SqlConnection.java @@ -23,10 +23,4 @@ public interface SqlConnection extends AutoCloseable { */ void checkConnection() throws SQLException; - /** - * @deprecated replaced with {@link AutoCloseable#close()} - */ - @Deprecated(forRemoval = true) - void closeConnection(); - }