From 2147ed682c68567d0417aee5db58ebea3f2649a8 Mon Sep 17 00:00:00 2001 From: teacmity Date: Thu, 17 Aug 2023 12:52:15 +0000 Subject: [PATCH] Change log messages to use the singular or plural forms instead of "noun(s)" --- .../boot/build/bom/bomr/UpgradeDependencies.java | 3 ++- .../actuate/endpoint/web/EndpointLinksResolver.java | 4 +++- .../freemarker/FreeMarkerAutoConfiguration.java | 5 +++-- .../boot/maven/RunIntegrationTests.java | 2 +- .../springframework/boot/maven/AbstractRunMojo.java | 12 ++++++++---- .../boot/web/embedded/jetty/GracefulShutdown.java | 3 ++- 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeDependencies.java b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeDependencies.java index 653fe98be8..695f1060e7 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeDependencies.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeDependencies.java @@ -160,8 +160,9 @@ public abstract class UpgradeDependencies extends DefaultTask { if (!availableLabels.containsAll(issueLabels)) { List unknownLabels = new ArrayList<>(issueLabels); unknownLabels.removeAll(availableLabels); + String suffix = (unknownLabels.size() == 1) ? "" : "s"; throw new InvalidUserDataException( - "Unknown label(s): " + StringUtils.collectionToCommaDelimitedString(unknownLabels)); + "Unknown label" + suffix + ": " + StringUtils.collectionToCommaDelimitedString(unknownLabels)); } return issueLabels; } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/EndpointLinksResolver.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/EndpointLinksResolver.java index cba80cde53..05dcd99c61 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/EndpointLinksResolver.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/EndpointLinksResolver.java @@ -55,7 +55,9 @@ public class EndpointLinksResolver { public EndpointLinksResolver(Collection> endpoints, String basePath) { this.endpoints = endpoints; if (logger.isInfoEnabled()) { - logger.info("Exposing " + endpoints.size() + " endpoint(s) beneath base path '" + basePath + "'"); + String suffix = (endpoints.size() == 1) ? "" : "s"; + logger + .info("Exposing " + endpoints.size() + " endpoint" + suffix + " beneath base path '" + basePath + "'"); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java index 254d8d7d4a..673acb1f5c 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java @@ -62,8 +62,9 @@ public class FreeMarkerAutoConfiguration { if (logger.isWarnEnabled() && this.properties.isCheckTemplateLocation()) { List locations = getLocations(); if (locations.stream().noneMatch(this::locationExists)) { - logger.warn("Cannot find template location(s): " + locations + " (please add some templates, " - + "check your FreeMarker configuration, or set " + String suffix = (locations.size() == 1) ? "" : "s"; + logger.warn("Cannot find template location" + suffix + ": " + locations + + " (please add some templates, " + "check your FreeMarker configuration, or set " + "spring.freemarker.check-template-location=false)"); } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/RunIntegrationTests.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/RunIntegrationTests.java index 12382d58ef..65a8cc6801 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/RunIntegrationTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/RunIntegrationTests.java @@ -38,7 +38,7 @@ class RunIntegrationTests { @TestTemplate void whenTheRunGoalIsExecutedTheApplicationIsForkedWithOptimizedJvmArguments(MavenBuild mavenBuild) { mavenBuild.project("run").goals("spring-boot:run", "-X").execute((project) -> { - String jvmArguments = "JVM argument(s): -XX:TieredStopAtLevel=1"; + String jvmArguments = "JVM argument: -XX:TieredStopAtLevel=1"; assertThat(buildLog(project)).contains("I haz been run").contains(jvmArguments); }); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java index 18a4009620..741fc20a15 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java @@ -277,12 +277,14 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { private void addArgs(List args) { RunArguments applicationArguments = resolveApplicationArguments(); Collections.addAll(args, applicationArguments.asArray()); - logArguments("Application argument(s): ", applicationArguments.asArray()); + String suffix = (applicationArguments.asArray().length == 1) ? "" : "s"; + logArguments("Application argument" + suffix + ": ", applicationArguments.asArray()); } private Map determineEnvironmentVariables() { EnvVariables envVariables = resolveEnvVariables(); - logArguments("Environment variable(s): ", envVariables.asArray()); + String suffix = (envVariables.asArray().length == 1) ? "" : "s"; + logArguments("Environment variable" + suffix + ": ", envVariables.asArray()); return envVariables.asMap(); } @@ -307,7 +309,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { private void addJvmArgs(List args) { RunArguments jvmArguments = resolveJvmArguments(); Collections.addAll(args, jvmArguments.asArray()); - logArguments("JVM argument(s): ", jvmArguments.asArray()); + String suffix = (jvmArguments.asArray().length == 1) ? "" : "s"; + logArguments("JVM argument" + suffix + ": ", jvmArguments.asArray()); } private void addAgents(List args) { @@ -334,7 +337,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { } } arguments.getArgs().addFirst(arg.toString()); - logArguments("Active profile(s): ", this.profiles); + String suffix = (this.profiles.length == 1) ? "" : "s"; + logArguments("Active profile" + suffix + ": ", this.profiles); } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/GracefulShutdown.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/GracefulShutdown.java index dc2580d25e..11ef928dba 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/GracefulShutdown.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/GracefulShutdown.java @@ -106,7 +106,8 @@ final class GracefulShutdown { callback.shutdownComplete(GracefulShutdownResult.IDLE); } else { - logger.info(LogMessage.format("Graceful shutdown aborted with %d request(s) still active", activeRequests)); + logger.info(LogMessage.format("Graceful shutdown aborted with %d request%s still active", activeRequests, + (activeRequests == 1) ? "" : "s")); callback.shutdownComplete(GracefulShutdownResult.REQUESTS_ACTIVE); } }