From 485abe29e339f664e95993e2f2c2dea2efeb4855 Mon Sep 17 00:00:00 2001 From: Louis Vallat Date: Tue, 27 Oct 2020 23:39:34 +0100 Subject: [PATCH] Fixed a small bug that would still import the languages if not needed Signed-off-by: Louis Vallat --- .../xyz/vallat/louis/database/LanguageManager.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/xyz/vallat/louis/database/LanguageManager.java b/src/main/java/xyz/vallat/louis/database/LanguageManager.java index ab3da2c..9b9dbe2 100644 --- a/src/main/java/xyz/vallat/louis/database/LanguageManager.java +++ b/src/main/java/xyz/vallat/louis/database/LanguageManager.java @@ -36,10 +36,12 @@ public final class LanguageManager { logger.debug("Stored hash was '{}'.", storedHash); String actualHash = getActualHash(); logger.debug("Actual hash is '{}'.", actualHash); - logger.info("Importing new language file."); - if (storedHash == null || !storedHash.equals(actualHash)) importLanguageFile(connection); - logger.debug("Saving new hash in database."); - saveProperty(HASH_KEY, actualHash); + if (storedHash == null || !storedHash.equals(actualHash)) { + logger.info("Importing new language file."); + importLanguageFile(connection); + logger.debug("Saving new hash in database."); + saveProperty(HASH_KEY, actualHash); + } } catch (SQLException | IOException | NoSuchAlgorithmException e) { logger.error("Cannot update the languages right now. Reason: {}", e.getMessage()); if (storedHash == null || storedHash.isEmpty()) System.exit(7);