mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-15 01:07:30 +08:00
Remove unnecessary toString()
calls
See gh-38739
This commit is contained in:
parent
b6e87cee35
commit
8599e5a986
@ -89,7 +89,7 @@ public abstract class ArchitectureCheck extends DefaultTask {
|
|||||||
if (!violations.isEmpty()) {
|
if (!violations.isEmpty()) {
|
||||||
StringBuilder report = new StringBuilder();
|
StringBuilder report = new StringBuilder();
|
||||||
for (EvaluationResult violation : violations) {
|
for (EvaluationResult violation : violations) {
|
||||||
report.append(violation.getFailureReport().toString());
|
report.append(violation.getFailureReport());
|
||||||
report.append(String.format("%n"));
|
report.append(String.format("%n"));
|
||||||
}
|
}
|
||||||
Files.writeString(outputFile.toPath(), report.toString(), StandardOpenOption.CREATE,
|
Files.writeString(outputFile.toPath(), report.toString(), StandardOpenOption.CREATE,
|
||||||
|
@ -69,7 +69,7 @@ final class MavenMetadataVersionResolver implements VersionResolver {
|
|||||||
if ("/".equals(uri.getPath())) {
|
if ("/".equals(uri.getPath())) {
|
||||||
return uri;
|
return uri;
|
||||||
}
|
}
|
||||||
return URI.create(uri.toString() + "/");
|
return URI.create(uri + "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -125,7 +125,7 @@ class WebEndpointAutoConfigurationTests {
|
|||||||
@Override
|
@Override
|
||||||
public String getRootPath(EndpointId endpointId) {
|
public String getRootPath(EndpointId endpointId) {
|
||||||
if (endpointId.toString().endsWith("one")) {
|
if (endpointId.toString().endsWith("one")) {
|
||||||
return "1/" + endpointId.toString();
|
return "1/" + endpointId;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -234,9 +234,8 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten
|
|||||||
String extensionBeanNames = extensions.stream()
|
String extensionBeanNames = extensions.stream()
|
||||||
.map(ExtensionBean::getBeanName)
|
.map(ExtensionBean::getBeanName)
|
||||||
.collect(Collectors.joining(", "));
|
.collect(Collectors.joining(", "));
|
||||||
throw new IllegalStateException("Unable to map duplicate endpoint operations: " + duplicates.toString()
|
throw new IllegalStateException("Unable to map duplicate endpoint operations: " + duplicates + " to "
|
||||||
+ " to " + endpointBean.getBeanName()
|
+ endpointBean.getBeanName() + (extensions.isEmpty() ? "" : " (" + extensionBeanNames + ")"));
|
||||||
+ (extensions.isEmpty() ? "" : " (" + extensionBeanNames + ")"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ class AssertProviderApplicationContextInvocationHandler implements InvocationHan
|
|||||||
|
|
||||||
private ApplicationContext getStartedApplicationContext() {
|
private ApplicationContext getStartedApplicationContext() {
|
||||||
if (this.startupFailure != null) {
|
if (this.startupFailure != null) {
|
||||||
throw new IllegalStateException(toString() + " failed to start", this.startupFailure);
|
throw new IllegalStateException(this + " failed to start", this.startupFailure);
|
||||||
}
|
}
|
||||||
return this.applicationContext;
|
return this.applicationContext;
|
||||||
}
|
}
|
||||||
|
@ -956,7 +956,7 @@ public class TestRestTemplate {
|
|||||||
private URI applyRootUriIfNecessary(URI uri) {
|
private URI applyRootUriIfNecessary(URI uri) {
|
||||||
UriTemplateHandler uriTemplateHandler = this.restTemplate.getUriTemplateHandler();
|
UriTemplateHandler uriTemplateHandler = this.restTemplate.getUriTemplateHandler();
|
||||||
if ((uriTemplateHandler instanceof RootUriTemplateHandler rootHandler) && uri.toString().startsWith("/")) {
|
if ((uriTemplateHandler instanceof RootUriTemplateHandler rootHandler) && uri.toString().startsWith("/")) {
|
||||||
return URI.create(rootHandler.getRootUri() + uri.toString());
|
return URI.create(rootHandler.getRootUri() + uri);
|
||||||
}
|
}
|
||||||
return uri;
|
return uri;
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,7 @@ public class LogbackLoggingSystem extends AbstractLoggingSystem implements BeanF
|
|||||||
for (Status status : loggerContext.getStatusManager().getCopyOfStatusList()) {
|
for (Status status : loggerContext.getStatusManager().getCopyOfStatusList()) {
|
||||||
if (status.getLevel() == Status.ERROR) {
|
if (status.getLevel() == Status.ERROR) {
|
||||||
errors.append((!errors.isEmpty()) ? String.format("%n") : "");
|
errors.append((!errors.isEmpty()) ? String.format("%n") : "");
|
||||||
errors.append(status.toString());
|
errors.append(status);
|
||||||
if (status.getThrowable() != null) {
|
if (status.getThrowable() != null) {
|
||||||
suppressedExceptions.add(status.getThrowable());
|
suppressedExceptions.add(status.getThrowable());
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -104,7 +104,7 @@ public class ApplicationPid {
|
|||||||
|
|
||||||
private void assertCanOverwrite(File file) throws IOException {
|
private void assertCanOverwrite(File file) throws IOException {
|
||||||
if (!file.canWrite() || !canWritePosixFile(file)) {
|
if (!file.canWrite() || !canWritePosixFile(file)) {
|
||||||
throw new FileNotFoundException(file.toString() + " (permission denied)");
|
throw new FileNotFoundException(file + " (permission denied)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -877,7 +877,7 @@ class ConfigDataEnvironmentPostProcessorIntegrationTests {
|
|||||||
map.put("spring", "boot");
|
map.put("spring", "boot");
|
||||||
}
|
}
|
||||||
String suffix = (!resource.isProfileSpecific()) ? "" : ":ps";
|
String suffix = (!resource.isProfileSpecific()) ? "" : ":ps";
|
||||||
map.put(resource.toString() + suffix, "true");
|
map.put(resource + suffix, "true");
|
||||||
MapPropertySource propertySource = new MapPropertySource("loaded" + suffix, map);
|
MapPropertySource propertySource = new MapPropertySource("loaded" + suffix, map);
|
||||||
return new ConfigData(Collections.singleton(propertySource));
|
return new ConfigData(Collections.singleton(propertySource));
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ class StaticResourceJarsTests {
|
|||||||
void ignoreWildcardUrls() throws Exception {
|
void ignoreWildcardUrls() throws Exception {
|
||||||
File jarFile = createResourcesJar("test-resources.jar");
|
File jarFile = createResourcesJar("test-resources.jar");
|
||||||
URL folderUrl = jarFile.getParentFile().toURI().toURL();
|
URL folderUrl = jarFile.getParentFile().toURI().toURL();
|
||||||
URL wildcardUrl = new URL(folderUrl.toString() + "*.jar");
|
URL wildcardUrl = new URL(folderUrl + "*.jar");
|
||||||
List<URL> staticResourceJarUrls = new StaticResourceJars().getUrlsFrom(wildcardUrl);
|
List<URL> staticResourceJarUrls = new StaticResourceJars().getUrlsFrom(wildcardUrl);
|
||||||
assertThat(staticResourceJarUrls).isEmpty();
|
assertThat(staticResourceJarUrls).isEmpty();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -141,7 +141,7 @@ public class Snake {
|
|||||||
sb.append(',');
|
sb.append(',');
|
||||||
sb.append(String.format("{x: %d, y: %d}", Integer.valueOf(location.x), Integer.valueOf(location.y)));
|
sb.append(String.format("{x: %d, y: %d}", Integer.valueOf(location.x), Integer.valueOf(location.y)));
|
||||||
}
|
}
|
||||||
return String.format("{'id':%d,'body':[%s]}", Integer.valueOf(this.id), sb.toString());
|
return String.format("{'id':%d,'body':[%s]}", Integer.valueOf(this.id), sb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -77,7 +77,7 @@ public final class SnakeTimer {
|
|||||||
sb.append(',');
|
sb.append(',');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
|
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void broadcast(String message) {
|
public static void broadcast(String message) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2020 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -74,7 +74,7 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler {
|
|||||||
sb.append(',');
|
sb.append(',');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SnakeTimer.broadcast(String.format("{'type': 'join','data':[%s]}", sb.toString()));
|
SnakeTimer.broadcast(String.format("{'type': 'join','data':[%s]}", sb));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -141,7 +141,7 @@ public class Snake {
|
|||||||
sb.append(',');
|
sb.append(',');
|
||||||
sb.append(String.format("{x: %d, y: %d}", Integer.valueOf(location.x), Integer.valueOf(location.y)));
|
sb.append(String.format("{x: %d, y: %d}", Integer.valueOf(location.x), Integer.valueOf(location.y)));
|
||||||
}
|
}
|
||||||
return String.format("{'id':%d,'body':[%s]}", Integer.valueOf(this.id), sb.toString());
|
return String.format("{'id':%d,'body':[%s]}", Integer.valueOf(this.id), sb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -77,7 +77,7 @@ public final class SnakeTimer {
|
|||||||
sb.append(',');
|
sb.append(',');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
|
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void broadcast(String message) {
|
public static void broadcast(String message) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2020 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -74,7 +74,7 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler {
|
|||||||
sb.append(',');
|
sb.append(',');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SnakeTimer.broadcast(String.format("{'type': 'join','data':[%s]}", sb.toString()));
|
SnakeTimer.broadcast(String.format("{'type': 'join','data':[%s]}", sb));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -141,7 +141,7 @@ public class Snake {
|
|||||||
sb.append(',');
|
sb.append(',');
|
||||||
sb.append(String.format("{x: %d, y: %d}", Integer.valueOf(location.x), Integer.valueOf(location.y)));
|
sb.append(String.format("{x: %d, y: %d}", Integer.valueOf(location.x), Integer.valueOf(location.y)));
|
||||||
}
|
}
|
||||||
return String.format("{'id':%d,'body':[%s]}", Integer.valueOf(this.id), sb.toString());
|
return String.format("{'id':%d,'body':[%s]}", Integer.valueOf(this.id), sb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -77,7 +77,7 @@ public final class SnakeTimer {
|
|||||||
sb.append(',');
|
sb.append(',');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
|
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void broadcast(String message) {
|
public static void broadcast(String message) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2020 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -74,7 +74,7 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler {
|
|||||||
sb.append(',');
|
sb.append(',');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SnakeTimer.broadcast(String.format("{'type': 'join','data':[%s]}", sb.toString()));
|
SnakeTimer.broadcast(String.format("{'type': 'join','data':[%s]}", sb));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user