Skip to content

Commit c6c7fbc

Browse files
teacmitywilkinsona
authored andcommitted
Change log messages to use singular or plural instead of "noun(s)"
See gh-37017
1 parent ef59326 commit c6c7fbc

File tree

6 files changed

+19
-10
lines changed

6 files changed

+19
-10
lines changed

buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeDependencies.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,9 @@ private List<String> verifyLabels(GitHubRepository repository) {
169169
if (!availableLabels.containsAll(issueLabels)) {
170170
List<String> unknownLabels = new ArrayList<>(issueLabels);
171171
unknownLabels.removeAll(availableLabels);
172+
String suffix = (unknownLabels.size() == 1) ? "" : "s";
172173
throw new InvalidUserDataException(
173-
"Unknown label(s): " + StringUtils.collectionToCommaDelimitedString(unknownLabels));
174+
"Unknown label" + suffix + ": " + StringUtils.collectionToCommaDelimitedString(unknownLabels));
174175
}
175176
return issueLabels;
176177
}

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/EndpointLinksResolver.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ public EndpointLinksResolver(Collection<? extends ExposableEndpoint<?>> endpoint
5555
public EndpointLinksResolver(Collection<? extends ExposableEndpoint<?>> endpoints, String basePath) {
5656
this.endpoints = endpoints;
5757
if (logger.isInfoEnabled()) {
58-
logger.info("Exposing " + endpoints.size() + " endpoint(s) beneath base path '" + basePath + "'");
58+
String suffix = (endpoints.size() == 1) ? "" : "s";
59+
logger
60+
.info("Exposing " + endpoints.size() + " endpoint" + suffix + " beneath base path '" + basePath + "'");
5961
}
6062
}
6163

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ public void checkTemplateLocationExists() {
6262
if (logger.isWarnEnabled() && this.properties.isCheckTemplateLocation()) {
6363
List<TemplateLocation> locations = getLocations();
6464
if (locations.stream().noneMatch(this::locationExists)) {
65-
logger.warn("Cannot find template location(s): " + locations + " (please add some templates, "
66-
+ "check your FreeMarker configuration, or set "
65+
String suffix = (locations.size() == 1) ? "" : "s";
66+
logger.warn("Cannot find template location" + suffix + ": " + locations
67+
+ " (please add some templates, " + "check your FreeMarker configuration, or set "
6768
+ "spring.freemarker.check-template-location=false)");
6869
}
6970
}

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/RunIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class RunIntegrationTests {
3838
@TestTemplate
3939
void whenTheRunGoalIsExecutedTheApplicationIsForkedWithOptimizedJvmArguments(MavenBuild mavenBuild) {
4040
mavenBuild.project("run").goals("spring-boot:run", "-X").execute((project) -> {
41-
String jvmArguments = "JVM argument(s): -XX:TieredStopAtLevel=1";
41+
String jvmArguments = "JVM argument: -XX:TieredStopAtLevel=1";
4242
assertThat(buildLog(project)).contains("I haz been run").contains(jvmArguments);
4343
});
4444
}

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,14 @@ protected EnvVariables resolveEnvVariables() {
277277
private void addArgs(List<String> args) {
278278
RunArguments applicationArguments = resolveApplicationArguments();
279279
Collections.addAll(args, applicationArguments.asArray());
280-
logArguments("Application argument(s): ", applicationArguments.asArray());
280+
String suffix = (applicationArguments.asArray().length == 1) ? "" : "s";
281+
logArguments("Application argument" + suffix + ": ", applicationArguments.asArray());
281282
}
282283

283284
private Map<String, String> determineEnvironmentVariables() {
284285
EnvVariables envVariables = resolveEnvVariables();
285-
logArguments("Environment variable(s): ", envVariables.asArray());
286+
String suffix = (envVariables.asArray().length == 1) ? "" : "s";
287+
logArguments("Environment variable" + suffix + ": ", envVariables.asArray());
286288
return envVariables.asMap();
287289
}
288290

@@ -307,7 +309,8 @@ protected RunArguments resolveJvmArguments() {
307309
private void addJvmArgs(List<String> args) {
308310
RunArguments jvmArguments = resolveJvmArguments();
309311
Collections.addAll(args, jvmArguments.asArray());
310-
logArguments("JVM argument(s): ", jvmArguments.asArray());
312+
String suffix = (jvmArguments.asArray().length == 1) ? "" : "s";
313+
logArguments("JVM argument" + suffix + ": ", jvmArguments.asArray());
311314
}
312315

313316
private void addAgents(List<String> args) {
@@ -334,7 +337,8 @@ private void addActiveProfileArgument(RunArguments arguments) {
334337
}
335338
}
336339
arguments.getArgs().addFirst(arg.toString());
337-
logArguments("Active profile(s): ", this.profiles);
340+
String suffix = (this.profiles.length == 1) ? "" : "s";
341+
logArguments("Active profile" + suffix + ": ", this.profiles);
338342
}
339343
}
340344

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/GracefulShutdown.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ private void awaitShutdown(GracefulShutdownCallback callback) {
107107
callback.shutdownComplete(GracefulShutdownResult.IDLE);
108108
}
109109
else {
110-
logger.info(LogMessage.format("Graceful shutdown aborted with %d request(s) still active", activeRequests));
110+
logger.info(LogMessage.format("Graceful shutdown aborted with %d request%s still active", activeRequests,
111+
(activeRequests == 1) ? "" : "s"));
111112
callback.shutdownComplete(GracefulShutdownResult.REQUESTS_ACTIVE);
112113
}
113114
}

0 commit comments

Comments
 (0)