Merge branch '3.1.x'

Closes gh-38877
This commit is contained in:
Phillip Webb 2023-12-19 22:51:48 -08:00
commit 5354ad15b3
45 changed files with 69 additions and 71 deletions

View File

@ -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,

View File

@ -154,7 +154,7 @@ public class AutoConfigurationPlugin implements Plugin<Project> {
}); });
} }
private static record AutoConfigurationImports(Path importsFile, List<String> imports) { private record AutoConfigurationImports(Path importsFile, List<String> imports) {
} }

View File

@ -221,7 +221,7 @@ public class BomPlugin implements Plugin<Project> {
.collect(Collectors.toSet()); .collect(Collectors.toSet());
Node target = dependency; Node target = dependency;
for (String classifier : classifiers) { for (String classifier : classifiers) {
if (classifier.length() > 0) { if (!classifier.isEmpty()) {
if (target == null) { if (target == null) {
target = new Node(null, "dependency"); target = new Node(null, "dependency");
target.appendNode("groupId", groupId); target.appendNode("groupId", groupId);

View File

@ -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

View File

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

View File

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

View File

@ -127,7 +127,7 @@ abstract class HealthEndpointSupport<C, T> {
private String getName(String[] path, int pathOffset) { private String getName(String[] path, int pathOffset) {
StringBuilder name = new StringBuilder(); StringBuilder name = new StringBuilder();
while (pathOffset < path.length) { while (pathOffset < path.length) {
name.append((name.length() != 0) ? "/" : ""); name.append((!name.isEmpty()) ? "/" : "");
name.append(path[pathOffset]); name.append(path[pathOffset]);
pathOffset++; pathOffset++;
} }

View File

@ -332,7 +332,7 @@ class OnBeanCondition extends FilteringSpringBootCondition implements Configurat
private void appendMessageForNoMatches(StringBuilder reason, Collection<String> unmatched, String description) { private void appendMessageForNoMatches(StringBuilder reason, Collection<String> unmatched, String description) {
if (!unmatched.isEmpty()) { if (!unmatched.isEmpty()) {
if (reason.length() > 0) { if (!reason.isEmpty()) {
reason.append(" and "); reason.append(" and ");
} }
reason.append("did not find any beans "); reason.append("did not find any beans ");
@ -347,7 +347,7 @@ class OnBeanCondition extends FilteringSpringBootCondition implements Configurat
appendMessageForMatches(reason, matchResult.getMatchedAnnotations(), "annotated with"); appendMessageForMatches(reason, matchResult.getMatchedAnnotations(), "annotated with");
appendMessageForMatches(reason, matchResult.getMatchedTypes(), "of type"); appendMessageForMatches(reason, matchResult.getMatchedTypes(), "of type");
if (!matchResult.getMatchedNames().isEmpty()) { if (!matchResult.getMatchedNames().isEmpty()) {
if (reason.length() > 0) { if (!reason.isEmpty()) {
reason.append(" and "); reason.append(" and ");
} }
reason.append("found beans named "); reason.append("found beans named ");
@ -360,7 +360,7 @@ class OnBeanCondition extends FilteringSpringBootCondition implements Configurat
String description) { String description) {
if (!matches.isEmpty()) { if (!matches.isEmpty()) {
matches.forEach((key, value) -> { matches.forEach((key, value) -> {
if (reason.length() > 0) { if (!reason.isEmpty()) {
reason.append(" and "); reason.append(" and ");
} }
reason.append("found beans "); reason.append("found beans ");

View File

@ -144,7 +144,7 @@ public class DevToolsHomePropertiesPostProcessor implements EnvironmentPostProce
} }
@SafeVarargs @SafeVarargs
private final File getHomeDirectory(Supplier<String>... pathSuppliers) { private File getHomeDirectory(Supplier<String>... pathSuppliers) {
for (Supplier<String> pathSupplier : pathSuppliers) { for (Supplier<String> pathSupplier : pathSuppliers) {
String path = pathSupplier.get(); String path = pathSupplier.get();
if (StringUtils.hasText(path)) { if (StringUtils.hasText(path)) {

View File

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

View File

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

View File

@ -169,7 +169,7 @@ abstract class AbstractJsonMarshalTesterTests {
assertThat(tester.parse(MAP_JSON)).asMap().containsEntry("a", OBJECT); assertThat(tester.parse(MAP_JSON)).asMap().containsEntry("a", OBJECT);
} }
protected static final ExampleObject createExampleObject(String name, int age) { protected static ExampleObject createExampleObject(String name, int age) {
ExampleObject exampleObject = new ExampleObject(); ExampleObject exampleObject = new ExampleObject();
exampleObject.setName(name); exampleObject.setName(name);
exampleObject.setAge(age); exampleObject.setAge(age);

View File

@ -91,8 +91,7 @@ class ServiceConnectionContextCustomizer implements ContextCustomizer {
* Relevant details from {@link ContainerConnectionSource} used as a * Relevant details from {@link ContainerConnectionSource} used as a
* MergedContextConfiguration cache key. * MergedContextConfiguration cache key.
*/ */
private static record CacheKey(String connectionName, Set<Class<?>> connectionDetailsTypes, private record CacheKey(String connectionName, Set<Class<?>> connectionDetailsTypes, Container<?> container) {
Container<?> container) {
CacheKey(ContainerConnectionSource<?> source) { CacheKey(ContainerConnectionSource<?> source) {
this(source.getConnectionName(), source.getConnectionDetailsTypes(), source.getContainerSupplier().get()); this(source.getConnectionName(), source.getConnectionDetailsTypes(), source.getContainerSupplier().get());

View File

@ -162,7 +162,7 @@ class ImportTestcontainersTests {
} }
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
static @interface ContainerAnnotation { @interface ContainerAnnotation {
} }

View File

@ -68,7 +68,7 @@ class TestcontainersPropertySourceAutoConfigurationTests {
} }
@ConfigurationProperties("container") @ConfigurationProperties("container")
static record ContainerProperties(int port) { record ContainerProperties(int port) {
} }
static class TestBean { static class TestBean {

View File

@ -345,7 +345,7 @@ public class AutoConfigureAnnotationProcessor extends AbstractProcessor {
} }
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
for (Object item : list) { for (Object item : list) {
result.append((result.length() != 0) ? "," : ""); result.append((!result.isEmpty()) ? "," : "");
result.append(item); result.append(item);
} }
return result.toString(); return result.toString();

View File

@ -173,7 +173,7 @@ public class JSONStringer {
* @throws JSONException if processing of json failed * @throws JSONException if processing of json failed
*/ */
JSONStringer open(Scope empty, String openBracket) throws JSONException { JSONStringer open(Scope empty, String openBracket) throws JSONException {
if (this.stack.isEmpty() && this.out.length() > 0) { if (this.stack.isEmpty() && !this.out.isEmpty()) {
throw new JSONException("Nesting problem: multiple top-level roots"); throw new JSONException("Nesting problem: multiple top-level roots");
} }
beforeValue(); beforeValue();
@ -423,7 +423,7 @@ public class JSONStringer {
*/ */
@Override @Override
public String toString() { public String toString() {
return this.out.length() == 0 ? null : this.out.toString(); return this.out.isEmpty() ? null : this.out.toString();
} }
} }

View File

@ -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.
@ -65,7 +65,7 @@ public final class ItemMetadata implements Comparable<ItemMetadata> {
fullName.append(prefix); fullName.append(prefix);
} }
if (name != null) { if (name != null) {
if (fullName.length() > 0) { if (!fullName.isEmpty()) {
fullName.append('.'); fullName.append('.');
} }
fullName.append(ConfigurationMetadata.toDashedCase(name)); fullName.append(ConfigurationMetadata.toDashedCase(name));

View File

@ -37,7 +37,7 @@ import org.springframework.util.FileCopyUtils;
*/ */
class TestPrintStream extends PrintStream implements AssertProvider<PrintStreamAssert> { class TestPrintStream extends PrintStream implements AssertProvider<PrintStreamAssert> {
private final Class<? extends Object> testClass; private final Class<?> testClass;
TestPrintStream(Object testInstance) { TestPrintStream(Object testInstance) {
super(new ByteArrayOutputStream()); super(new ByteArrayOutputStream());

View File

@ -227,7 +227,7 @@ public abstract class AbstractAotMojo extends AbstractDependencyFilterMojo {
} }
boolean hasReportedErrors() { boolean hasReportedErrors() {
return this.message.length() > 0; return !this.message.isEmpty();
} }
@Override @Override

View File

@ -342,7 +342,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
try { try {
StringBuilder classpath = new StringBuilder(); StringBuilder classpath = new StringBuilder();
for (URL ele : getClassPathUrls()) { for (URL ele : getClassPathUrls()) {
if (classpath.length() > 0) { if (!classpath.isEmpty()) {
classpath.append(File.pathSeparator); classpath.append(File.pathSeparator);
} }
classpath.append(new File(ele.toURI())); classpath.append(new File(ele.toURI()));

View File

@ -98,7 +98,7 @@ final class CommandLineBuilder {
static String build(List<URL> classpathElements) { static String build(List<URL> classpathElements) {
StringBuilder classpath = new StringBuilder(); StringBuilder classpath = new StringBuilder();
for (URL element : classpathElements) { for (URL element : classpathElements) {
if (classpath.length() > 0) { if (!classpath.isEmpty()) {
classpath.append(File.pathSeparator); classpath.append(File.pathSeparator);
} }
classpath.append(toFile(element)); classpath.append(toFile(element));

View File

@ -118,7 +118,7 @@ class StartupInfoLogger {
} }
append(context, "started by ", () -> System.getProperty("user.name")); append(context, "started by ", () -> System.getProperty("user.name"));
append(context, "in ", () -> System.getProperty("user.dir")); append(context, "in ", () -> System.getProperty("user.dir"));
if (context.length() > 0) { if (!context.isEmpty()) {
message.append(" ("); message.append(" (");
message.append(context); message.append(context);
message.append(")"); message.append(")");
@ -140,7 +140,7 @@ class StartupInfoLogger {
value = defaultValue; value = defaultValue;
} }
if (StringUtils.hasLength(value)) { if (StringUtils.hasLength(value)) {
message.append((message.length() > 0) ? " " : ""); message.append((!message.isEmpty()) ? " " : "");
message.append(prefix); message.append(prefix);
message.append(value); message.append(value);
} }

View File

@ -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.
@ -52,7 +52,7 @@ public abstract class DataObjectPropertyName {
} }
else { else {
ch = (ch != '_') ? ch : '-'; ch = (ch != '_') ? ch : '-';
if (Character.isUpperCase(ch) && result.length() > 0 && result.charAt(result.length() - 1) != '-') { if (Character.isUpperCase(ch) && !result.isEmpty() && result.charAt(result.length() - 1) != '-') {
result.append('-'); result.append('-');
} }
result.append(Character.toLowerCase(ch)); result.append(Character.toLowerCase(ch));

View File

@ -211,7 +211,7 @@ class MapBinder extends AggregateBinder<Map<Object, Object>> {
private String getKeyName(ConfigurationPropertyName name) { private String getKeyName(ConfigurationPropertyName name) {
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
for (int i = this.root.getNumberOfElements(); i < name.getNumberOfElements(); i++) { for (int i = this.root.getNumberOfElements(); i < name.getNumberOfElements(); i++) {
if (result.length() != 0) { if (!result.isEmpty()) {
result.append('.'); result.append('.');
} }
result.append(name.getElement(i, Form.ORIGINAL)); result.append(name.getElement(i, Form.ORIGINAL));

View File

@ -543,7 +543,7 @@ public final class ConfigurationPropertyName implements Comparable<Configuration
StringBuilder result = new StringBuilder(elements * 8); StringBuilder result = new StringBuilder(elements * 8);
for (int i = 0; i < elements; i++) { for (int i = 0; i < elements; i++) {
boolean indexed = isIndexed(i); boolean indexed = isIndexed(i);
if (result.length() > 0 && !indexed) { if (!result.isEmpty() && !indexed) {
result.append('.'); result.append('.');
} }
if (indexed) { if (indexed) {
@ -615,7 +615,7 @@ public final class ConfigurationPropertyName implements Comparable<Configuration
Assert.isTrue(returnNullIfInvalid, "Name must not be null"); Assert.isTrue(returnNullIfInvalid, "Name must not be null");
return null; return null;
} }
if (name.length() == 0) { if (name.isEmpty()) {
return Elements.EMPTY; return Elements.EMPTY;
} }
if (name.charAt(0) == '.' || name.charAt(name.length() - 1) == '.') { if (name.charAt(0) == '.' || name.charAt(name.length() - 1) == '.') {
@ -674,7 +674,7 @@ public final class ConfigurationPropertyName implements Comparable<Configuration
static ConfigurationPropertyName adapt(CharSequence name, char separator, static ConfigurationPropertyName adapt(CharSequence name, char separator,
Function<CharSequence, CharSequence> elementValueProcessor) { Function<CharSequence, CharSequence> elementValueProcessor) {
Assert.notNull(name, "Name must not be null"); Assert.notNull(name, "Name must not be null");
if (name.length() == 0) { if (name.isEmpty()) {
return EMPTY; return EMPTY;
} }
Elements elements = new ElementsParser(name, separator).parse(elementValueProcessor); Elements elements = new ElementsParser(name, separator).parse(elementValueProcessor);

View File

@ -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.
@ -57,7 +57,7 @@ final class SystemEnvironmentPropertyMapper implements PropertyMapper {
private String convertName(ConfigurationPropertyName name, int numberOfElements) { private String convertName(ConfigurationPropertyName name, int numberOfElements) {
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
for (int i = 0; i < numberOfElements; i++) { for (int i = 0; i < numberOfElements; i++) {
if (result.length() > 0) { if (!result.isEmpty()) {
result.append('_'); result.append('_');
} }
result.append(name.getElement(i, Form.UNIFORM).toUpperCase(Locale.ENGLISH)); result.append(name.getElement(i, Form.UNIFORM).toUpperCase(Locale.ENGLISH));
@ -68,7 +68,7 @@ final class SystemEnvironmentPropertyMapper implements PropertyMapper {
private String convertLegacyName(ConfigurationPropertyName name) { private String convertLegacyName(ConfigurationPropertyName name) {
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
for (int i = 0; i < name.getNumberOfElements(); i++) { for (int i = 0; i < name.getNumberOfElements(); i++) {
if (result.length() > 0) { if (!result.isEmpty()) {
result.append('_'); result.append('_');
} }
result.append(convertLegacyNameElement(name.getElement(i, Form.ORIGINAL))); result.append(convertLegacyNameElement(name.getElement(i, Form.ORIGINAL)));

View File

@ -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.
@ -158,7 +158,7 @@ public class BasicJsonParser extends AbstractJsonParser {
} }
index++; index++;
} }
if (build.length() > 0) { if (!build.isEmpty()) {
list.add(build.toString().trim()); list.add(build.toString().trim());
} }
return list; return list;

View File

@ -130,7 +130,7 @@ public final class ColorConverter extends LogEventPatternConverter {
for (PatternFormatter formatter : this.formatters) { for (PatternFormatter formatter : this.formatters) {
formatter.format(event, buf); formatter.format(event, buf);
} }
if (buf.length() > 0) { if (!buf.isEmpty()) {
AnsiElement element = this.styling; AnsiElement element = this.styling;
if (element == null) { if (element == null) {
// Assume highlighting // Assume highlighting

View File

@ -260,14 +260,14 @@ public class LogbackLoggingSystem extends AbstractLoggingSystem implements BeanF
List<Throwable> suppressedExceptions = new ArrayList<>(); List<Throwable> suppressedExceptions = new ArrayList<>();
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.length() > 0) ? 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());
} }
} }
} }
if (errors.length() == 0) { if (errors.isEmpty()) {
if (!StatusUtil.contextHasStatusListener(loggerContext)) { if (!StatusUtil.contextHasStatusListener(loggerContext)) {
StatusPrinter.printInCaseOfErrorsOrWarnings(loggerContext); StatusPrinter.printInCaseOfErrorsOrWarnings(loggerContext);
} }

View File

@ -245,7 +245,7 @@ public final class ConnectionFactoryBuilder {
private ConnectionFactoryOptions delegateFactoryOptions(ConnectionFactoryOptions options) { private ConnectionFactoryOptions delegateFactoryOptions(ConnectionFactoryOptions options) {
String protocol = toString(options.getRequiredValue(ConnectionFactoryOptions.PROTOCOL)); String protocol = toString(options.getRequiredValue(ConnectionFactoryOptions.PROTOCOL));
if (protocol.trim().length() == 0) { if (protocol.trim().isEmpty()) {
throw new IllegalArgumentException(String.format("Protocol %s is not valid.", protocol)); throw new IllegalArgumentException(String.format("Protocol %s is not valid.", protocol));
} }
String[] protocols = protocol.split(COLON, 2); String[] protocols = protocol.split(COLON, 2);

View File

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

View File

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

View File

@ -3091,7 +3091,7 @@ class ConfigurationPropertiesTests {
} }
static record NestedRecord(String name) { record NestedRecord(String name) {
} }
@EnableConfigurationProperties @EnableConfigurationProperties

View File

@ -207,7 +207,7 @@ class DefaultBindConstructorProviderTests {
} }
static record OneConstructorOnRecord(String name, int age) { record OneConstructorOnRecord(String name, int age) {
} }

View File

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

View File

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

View File

@ -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) {

View File

@ -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

View File

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

View File

@ -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) {

View File

@ -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

View File

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

View File

@ -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) {

View File

@ -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