From 76000b26cffc5f9ddbf3102ce986097cfb2a24e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=A4kil=C3=A4?= Date: Fri, 27 Sep 2024 18:01:18 +0300 Subject: [PATCH] moooore rules --- .../webhooklogger.java-conventions.gradle.kts | 5 +++++ .../webhooklogger/common/config/ConfigManager.java | 6 ++++-- config/checkstyle/checkstyle.xml | 13 +++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/webhooklogger.java-conventions.gradle.kts b/buildSrc/src/main/kotlin/webhooklogger.java-conventions.gradle.kts index 245dd75..af04ca9 100644 --- a/buildSrc/src/main/kotlin/webhooklogger.java-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/webhooklogger.java-conventions.gradle.kts @@ -7,6 +7,11 @@ group = rootProject.group version = rootProject.version description = rootProject.description +checkstyle { + toolVersion = "10.18.1" +} + + java.toolchain { languageVersion.set(JavaLanguageVersion.of(21)) } diff --git a/common/src/main/java/fi/fabianadrian/webhooklogger/common/config/ConfigManager.java b/common/src/main/java/fi/fabianadrian/webhooklogger/common/config/ConfigManager.java index 218fe47..12ffee2 100644 --- a/common/src/main/java/fi/fabianadrian/webhooklogger/common/config/ConfigManager.java +++ b/common/src/main/java/fi/fabianadrian/webhooklogger/common/config/ConfigManager.java @@ -1,8 +1,10 @@ package fi.fabianadrian.webhooklogger.common.config; import org.slf4j.Logger; +import space.arim.dazzleconf.error.InvalidConfigException; import space.arim.dazzleconf.helper.ConfigurationHelper; +import java.io.IOException; import java.nio.file.Path; public final class ConfigManager { @@ -41,7 +43,7 @@ public boolean reload() { boolean success = true; try { this.mainConfigData = this.mainConfigHelper.reloadConfigData(); - } catch (Exception e) { + } catch (IOException | InvalidConfigException e) { this.logger.error("Could not load config.yml, falling back to default configuration", e); this.mainConfigData = this.mainConfigHelper.getFactory().loadDefaults(); success = false; @@ -49,7 +51,7 @@ public boolean reload() { try { this.eventsConfigData = this.eventsConfigHelper.reloadConfigData(); - } catch (Exception e) { + } catch (IOException | InvalidConfigException e) { this.logger.error("Could not load events.yml, falling back to default configuration", e); this.eventsConfigData = this.eventsConfigHelper.getFactory().loadDefaults(); success = false; diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index 107dbf0..0afe9f5 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -25,11 +25,24 @@ + + + + + + + + + + + + +