diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportMessage.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportMessage.java index 802206cd9f8..efe02b06ab0 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportMessage.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportMessage.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,12 +53,9 @@ public class ConditionEvaluationReportMessage { } private StringBuilder getLogMessage(ConditionEvaluationReport report, String title) { + String separator = "=".repeat(title.length()); StringBuilder message = new StringBuilder(); message.append(String.format("%n%n%n")); - StringBuilder separator = new StringBuilder(); - for (int i = 0; i < title.length(); i++) { - separator.append("="); - } message.append(String.format("%s%n", separator)); message.append(String.format("%s%n", title)); message.append(String.format("%s%n%n%n", separator)); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java index 7735a221f34..887869f5429 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java @@ -494,11 +494,7 @@ class ServerPropertiesTests { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); MultiValueMap body = new LinkedMultiValueMap<>(); - StringBuilder data = new StringBuilder(); - for (int i = 0; i < 250000; i++) { - data.append("a"); - } - body.add("data", data.toString()); + body.add("data", "a".repeat(250000)); HttpEntity> entity = new HttpEntity<>(body, headers); template.postForEntity(URI.create("http://localhost:" + jetty.getPort() + "/form"), entity, Void.class); assertThat(failure.get()).isNotNull(); diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java index 002c15d127f..352b0501384 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -65,9 +65,9 @@ class ServiceCapabilitiesReportGenerator { private String generateHelp(String url, InitializrServiceMetadata metadata) { String header = "Capabilities of " + url; StringBuilder report = new StringBuilder(); - report.append(repeat("=", header.length())).append(NEW_LINE); + report.append("=".repeat(header.length())).append(NEW_LINE); report.append(header).append(NEW_LINE); - report.append(repeat("=", header.length())).append(NEW_LINE); + report.append("=".repeat(header.length())).append(NEW_LINE); report.append(NEW_LINE); reportAvailableDependencies(metadata, report); report.append(NEW_LINE); @@ -139,12 +139,4 @@ class ServiceCapabilitiesReportGenerator { } } - private static String repeat(String s, int count) { - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < count; i++) { - sb.append(s); - } - return sb.toString(); - } - }