Skip to content

Commit f7397b9

Browse files
committed
Merge branch '3.2.x'
2 parents 6d192e6 + ea52a44 commit f7397b9

File tree

6 files changed

+11
-32
lines changed

6 files changed

+11
-32
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/pulsar/PulsarPropertiesMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ private String getAuthenticationParamsJson(Map<String, String> params) {
135135
try {
136136
return sortedParams.entrySet()
137137
.stream()
138-
.map((e) -> "\"%s\":\"%s\"".formatted(e.getKey(), e.getValue()))
138+
.map((entry) -> "\"%s\":\"%s\"".formatted(entry.getKey(), entry.getValue()))
139139
.collect(Collectors.joining(",", "{", "}"));
140140
}
141141
catch (Exception ex) {

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/service/connection/ConnectionDetailsFactories.java

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -122,28 +122,11 @@ record Registration<S, D extends ConnectionDetails>(Class<S> sourceType, Class<D
122122
@SuppressWarnings("unchecked")
123123
private static <S, D extends ConnectionDetails> Registration<S, D> get(ConnectionDetailsFactory<S, D> factory) {
124124
ResolvableType type = ResolvableType.forClass(ConnectionDetailsFactory.class, factory.getClass());
125-
Class<?>[] generics = resolveGenerics(type);
126-
if (generics != null) {
127-
return new Registration<>((Class<S>) generics[0], (Class<D>) generics[1], factory);
128-
}
129-
return null;
130-
}
131-
132-
/**
133-
* Resolve the generics of the given {@link ResolvableType} or {@code null} if any
134-
* of them cannot be resolved.
135-
* @param type the type to inspect
136-
* @return the resolved generics if they can be loaded from the classpath,
137-
* {@code null} otherwise
138-
*/
139-
private static Class<?>[] resolveGenerics(ResolvableType type) {
140-
Class<?>[] resolvedGenerics = type.resolveGenerics();
141-
for (Class<?> genericRawType : resolvedGenerics) {
142-
if (genericRawType == null) {
143-
return null;
144-
}
145-
}
146-
return resolvedGenerics;
125+
Class<?>[] generics = type.resolveGenerics();
126+
Class<S> sourceType = (Class<S>) generics[0];
127+
Class<D> connectionDetailsType = (Class<D>) generics[1];
128+
return (sourceType != null && connectionDetailsType != null)
129+
? new Registration<>(sourceType, connectionDetailsType, factory) : null;
147130
}
148131

149132
}

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,6 @@ void shouldConfigureVirtualThreadsForSimpleListener() {
569569
Object virtualThread = ReflectionTestUtils.getField(taskExecutor, "virtualThreadFactory");
570570
Thread threadCreated = ((ThreadFactory) virtualThread).newThread(mock(Runnable.class));
571571
assertThat(threadCreated.getName()).containsPattern("rabbit-simple-[0-9]+");
572-
573572
});
574573
}
575574

@@ -586,7 +585,6 @@ void shouldConfigureVirtualThreadsForDirectListener() {
586585
Object virtualThread = ReflectionTestUtils.getField(taskExecutor, "virtualThreadFactory");
587586
Thread threadCreated = ((ThreadFactory) virtualThread).newThread(mock(Runnable.class));
588587
assertThat(threadCreated.getName()).containsPattern("rabbit-direct-[0-9]+");
589-
590588
});
591589
}
592590

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplicationBannerPrinter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ private Banner getTextBanner(Environment environment) {
9797
private String createStringFromBanner(Banner banner, Environment environment, Class<?> mainApplicationClass)
9898
throws UnsupportedEncodingException {
9999
String charset = environment.getProperty("spring.banner.charset", StandardCharsets.UTF_8.name());
100-
ByteArrayOutputStream baos = new ByteArrayOutputStream();
101-
try (PrintStream printStream = new PrintStream(baos, false, charset)) {
102-
banner.printBanner(environment, mainApplicationClass, printStream);
100+
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
101+
try (PrintStream out = new PrintStream(byteArrayOutputStream, false, charset)) {
102+
banner.printBanner(environment, mainApplicationClass, out);
103103
}
104-
return baos.toString(charset);
104+
return byteArrayOutputStream.toString(charset);
105105
}
106106

107107
/**

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/MapBinder.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ protected Object bindAggregate(ConfigurationPropertyName name, Bindable<?> targe
6262
ConfigurationProperty property = source.getConfigurationProperty(name);
6363
if (property != null && !hasDescendants) {
6464
getContext().setConfigurationProperty(property);
65-
Object result = property.getValue();
66-
result = getContext().getPlaceholdersResolver().resolvePlaceholders(result);
65+
Object result = getContext().getPlaceholdersResolver().resolvePlaceholders(property.getValue());
6766
return getContext().getConverter().convert(result, target);
6867
}
6968
source = source.filter(name::isAncestorOf);

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ private void awaitInactiveOrAborted() {
104104
}
105105
}
106106
}
107-
108107
}
109108
catch (InterruptedException ex) {
110109
Thread.currentThread().interrupt();

0 commit comments

Comments
 (0)