Change log messages to use the singular or plural forms instead of "noun(s)"

pull/37017/head
teacmity 1 year ago
parent df1d4c7b90
commit 2147ed682c

@ -160,8 +160,9 @@ public abstract class UpgradeDependencies extends DefaultTask {
if (!availableLabels.containsAll(issueLabels)) {
List<String> 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;
}

@ -55,7 +55,9 @@ public class EndpointLinksResolver {
public EndpointLinksResolver(Collection<? extends ExposableEndpoint<?>> 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 + "'");
}
}

@ -62,8 +62,9 @@ public class FreeMarkerAutoConfiguration {
if (logger.isWarnEnabled() && this.properties.isCheckTemplateLocation()) {
List<TemplateLocation> 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)");
}
}

@ -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);
});
}

@ -277,12 +277,14 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
private void addArgs(List<String> 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<String, String> 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<String> 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<String> 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);
}
}

@ -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);
}
}

Loading…
Cancel
Save