diff --git a/application/build.gradle b/application/build.gradle index 653fde0965..baddb8e2ae 100644 --- a/application/build.gradle +++ b/application/build.gradle @@ -51,7 +51,7 @@ dependencies { implementation 'org.apache.logging.log4j:log4j-core:2.25.0' runtimeOnly 'org.apache.logging.log4j:log4j-slf4j2-impl:2.25.0' - implementation 'club.minnced:discord-webhooks:0.8.2' + implementation 'club.minnced:discord-webhooks:0.8.4' implementation "org.jooq:jooq:$jooqVersion" @@ -81,10 +81,10 @@ dependencies { implementation 'com.apptasticsoftware:rssreader:3.9.3' testImplementation 'org.mockito:mockito-core:5.18.0' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.4' - testImplementation 'org.junit.jupiter:junit-jupiter-params:5.11.0' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.13.2' + testImplementation 'org.junit.jupiter:junit-jupiter-params:5.13.2' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.1' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.13.2' implementation "com.theokanning.openai-gpt3-java:api:$chatGPTVersion" implementation "com.theokanning.openai-gpt3-java:service:$chatGPTVersion" @@ -92,4 +92,5 @@ dependencies { application { mainClass = 'org.togetherjava.tjbot.Application' + applicationDefaultJvmArgs = ["--enable-native-access=ALL-UNNAMED"] } diff --git a/application/src/main/java/org/togetherjava/tjbot/features/jshell/renderer/RendererUtils.java b/application/src/main/java/org/togetherjava/tjbot/features/jshell/renderer/RendererUtils.java index 9d44c0df57..c36695af77 100644 --- a/application/src/main/java/org/togetherjava/tjbot/features/jshell/renderer/RendererUtils.java +++ b/application/src/main/java/org/togetherjava/tjbot/features/jshell/renderer/RendererUtils.java @@ -23,12 +23,12 @@ private RendererUtils() {} static String abortionCauseToString(JShellEvalAbortionCause abortionCause) { return switch (abortionCause) { - case JShellEvalAbortionCause.TimeoutAbortionCause ignored -> "Allowed time exceeded."; + case JShellEvalAbortionCause.TimeoutAbortionCause _ -> "Allowed time exceeded."; case JShellEvalAbortionCause.UnhandledExceptionAbortionCause(String exceptionClass, String exceptionMessage) -> "Uncaught exception:\n" + exceptionClass + ":" + exceptionMessage; case JShellEvalAbortionCause.CompileTimeErrorAbortionCause(List errors) -> "The code doesn't compile:\n" + String.join("\n", errors); - case JShellEvalAbortionCause.SyntaxErrorAbortionCause ignored -> + case JShellEvalAbortionCause.SyntaxErrorAbortionCause _ -> "The code doesn't compile, there are syntax errors in this code."; }; } diff --git a/application/src/main/java/org/togetherjava/tjbot/features/moderation/scam/ScamDetector.java b/application/src/main/java/org/togetherjava/tjbot/features/moderation/scam/ScamDetector.java index c4ebed3657..33a9a28743 100644 --- a/application/src/main/java/org/togetherjava/tjbot/features/moderation/scam/ScamDetector.java +++ b/application/src/main/java/org/togetherjava/tjbot/features/moderation/scam/ScamDetector.java @@ -80,7 +80,7 @@ private void analyzeUrl(String url, AnalyseResults results) { String host; try { host = URI.create(url).getHost(); - } catch (IllegalArgumentException e) { + } catch (IllegalArgumentException _) { // Invalid urls are not scam return; } diff --git a/application/src/main/java/org/togetherjava/tjbot/features/rss/RSSHandlerRoutine.java b/application/src/main/java/org/togetherjava/tjbot/features/rss/RSSHandlerRoutine.java index 770915cabe..c86f305cda 100644 --- a/application/src/main/java/org/togetherjava/tjbot/features/rss/RSSHandlerRoutine.java +++ b/application/src/main/java/org/togetherjava/tjbot/features/rss/RSSHandlerRoutine.java @@ -214,7 +214,7 @@ private Optional getLastSavedDateFromDatabaseRecord(RssFeedRecord ZonedDateTime savedDate = getZonedDateTime(rssRecord.getLastDate(), dateFormatterPattern); return Optional.of(savedDate); - } catch (DateTimeParseException e) { + } catch (DateTimeParseException _) { return Optional.empty(); } } @@ -317,7 +317,7 @@ private static boolean isValidDateFormat(Item rssItem, RSSFeed feedConfig) { // that the format pattern defined in the config and the // feed's actual format differ. getZonedDateTime(firstRssFeedPubDate.get(), feedConfig.dateFormatterPattern()); - } catch (DateTimeParseException e) { + } catch (DateTimeParseException _) { return false; } return true; diff --git a/application/src/main/java/org/togetherjava/tjbot/features/tags/TagManageCommand.java b/application/src/main/java/org/togetherjava/tjbot/features/tags/TagManageCommand.java index eb7dbecbe9..c720775ad8 100644 --- a/application/src/main/java/org/togetherjava/tjbot/features/tags/TagManageCommand.java +++ b/application/src/main/java/org/togetherjava/tjbot/features/tags/TagManageCommand.java @@ -130,7 +130,7 @@ private static void sendSuccessMessage(IReplyCallback event, String id, String a private static OptionalLong parseMessageIdAndHandle(String messageId, IReplyCallback event) { try { return OptionalLong.of(Long.parseLong(messageId)); - } catch (NumberFormatException e) { + } catch (NumberFormatException _) { event .reply("The given message id '%s' is invalid, expected a number." .formatted(messageId)) @@ -297,7 +297,7 @@ private Optional getTagContent(Subcommand subcommand, String id) { if (Subcommand.SUBCOMMANDS_WITH_PREVIOUS_CONTENT.contains(subcommand)) { try { return tagSystem.getTag(id); - } catch (NoSuchElementException e) { + } catch (NoSuchElementException _) { // NOTE Rare race condition, for example if another thread deleted the tag in the // meantime logger.warn("Tried to retrieve content of tag '{}', but the content doesn't exist.", diff --git a/build.gradle b/build.gradle index 67759b5bb5..cd6d2afde3 100644 --- a/build.gradle +++ b/build.gradle @@ -31,7 +31,7 @@ sonarqube { } // Install git hooks -task installLocalGitHook(type: Copy) { +tasks.register('installLocalGitHook', Copy) { from new File(rootProject.rootDir, 'scripts/pre-commit') into new File(rootProject.rootDir, '.git/hooks') fileMode 0775 @@ -97,5 +97,4 @@ subprojects { compileTestJava { options.encoding = "UTF-8" } - }