Skip to content

Commit 07462be

Browse files
committed
Polish
1 parent 89173bd commit 07462be

File tree

17 files changed

+46
-35
lines changed

17 files changed

+46
-35
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/Token.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ public Token(String encoded) {
6161
private Map<String, Object> parseJson(String base64) {
6262
try {
6363
byte[] bytes = Base64Utils.decodeFromUrlSafeString(base64);
64-
return JsonParserFactory.getJsonParser().parseMap(new String(bytes, StandardCharsets.UTF_8));
64+
return JsonParserFactory.getJsonParser()
65+
.parseMap(new String(bytes, StandardCharsets.UTF_8));
6566
}
6667
catch (RuntimeException ex) {
6768
throw new CloudFoundryAuthorizationException(Reason.INVALID_TOKEN,

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/CompositeHandlerExceptionResolverTests.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,20 @@ public class CompositeHandlerExceptionResolverTests {
5050
@Test
5151
public void resolverShouldDelegateToOtherResolversInContext() throws Exception {
5252
load(TestConfiguration.class);
53-
CompositeHandlerExceptionResolver resolver = (CompositeHandlerExceptionResolver) this.context.getBean(DispatcherServlet.HANDLER_EXCEPTION_RESOLVER_BEAN_NAME);
54-
ModelAndView resolved = resolver.resolveException(this.request, this.response, null, new HttpRequestMethodNotSupportedException("POST"));
53+
CompositeHandlerExceptionResolver resolver = (CompositeHandlerExceptionResolver) this.context
54+
.getBean(DispatcherServlet.HANDLER_EXCEPTION_RESOLVER_BEAN_NAME);
55+
ModelAndView resolved = resolver.resolveException(this.request, this.response,
56+
null, new HttpRequestMethodNotSupportedException("POST"));
5557
assertThat(resolved.getViewName()).isEqualTo("test-view");
5658
}
5759

5860
@Test
5961
public void resolverShouldAddDefaultResolverIfNonePresent() throws Exception {
6062
load(BaseConfiguration.class);
61-
CompositeHandlerExceptionResolver resolver = (CompositeHandlerExceptionResolver) this.context.getBean(DispatcherServlet.HANDLER_EXCEPTION_RESOLVER_BEAN_NAME);
62-
ModelAndView resolved = resolver.resolveException(this.request, this.response, null, new HttpRequestMethodNotSupportedException("POST"));
63+
CompositeHandlerExceptionResolver resolver = (CompositeHandlerExceptionResolver) this.context
64+
.getBean(DispatcherServlet.HANDLER_EXCEPTION_RESOLVER_BEAN_NAME);
65+
ModelAndView resolved = resolver.resolveException(this.request, this.response,
66+
null, new HttpRequestMethodNotSupportedException("POST"));
6367
assertThat(resolved).isNotNull();
6468
}
6569

@@ -94,7 +98,8 @@ public HandlerExceptionResolver testResolver() {
9498
static class TestHandlerExceptionResolver implements HandlerExceptionResolver {
9599

96100
@Override
97-
public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
101+
public ModelAndView resolveException(HttpServletRequest request,
102+
HttpServletResponse response, Object handler, Exception ex) {
98103
return new ModelAndView("test-view");
99104
}
100105

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/integration/SpringIntegrationMetrics.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ private <T> void registerTimedGauge(MeterRegistry registry, T object,
150150
private <T> void registerFunctionCounter(MeterRegistry registry, T object,
151151
Iterable<Tag> tags, String name, String description,
152152
ToDoubleFunction<T> value) {
153-
FunctionCounter.builder(name, object, value).tags(tags)
154-
.description(description).register(registry);
153+
FunctionCounter.builder(name, object, value).tags(tags).description(description)
154+
.register(registry);
155155
}
156156

157157
@Override

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingListener.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ public class ConditionEvaluationReportLoggingListener
5757
@Override
5858
public void initialize(ConfigurableApplicationContext applicationContext) {
5959
this.applicationContext = applicationContext;
60-
applicationContext.addApplicationListener(new ConditionEvaluationReportListener());
60+
applicationContext
61+
.addApplicationListener(new ConditionEvaluationReportListener());
6162
if (applicationContext instanceof GenericApplicationContext) {
6263
// Get the report early in case the context fails to load
6364
this.report = ConditionEvaluationReport

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingListenerTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,7 @@ public void noErrorIfNotInitialized() throws Exception {
147147
private void withDebugLogging(Runnable runnable) {
148148
LoggerContext context = (LoggerContext) StaticLoggerBinder.getSingleton()
149149
.getLoggerFactory();
150-
Logger logger = context
151-
.getLogger(ConditionEvaluationReportLoggingListener.class);
150+
Logger logger = context.getLogger(ConditionEvaluationReportLoggingListener.class);
152151
Level currentLevel = logger.getLevel();
153152
logger.setLevel(Level.DEBUG);
154153
try {

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandlerIntegrationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,10 @@ private void load(String... arguments) {
203203
@Target(ElementType.TYPE)
204204
@Retention(RetentionPolicy.RUNTIME)
205205
@Documented
206-
@Import({ReactiveWebServerAutoConfiguration.class,
206+
@Import({ ReactiveWebServerAutoConfiguration.class,
207207
HttpHandlerAutoConfiguration.class, WebFluxAutoConfiguration.class,
208208
ErrorWebFluxAutoConfiguration.class,
209-
PropertyPlaceholderAutoConfiguration.class})
209+
PropertyPlaceholderAutoConfiguration.class })
210210
private @interface MinimalWebConfiguration {
211211

212212
}

spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/util/TestPropertyValuesTests.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ public void applyToDefaultPropertySource() throws Exception {
5454

5555
@Test
5656
public void applyToSystemPropertySource() throws Exception {
57-
TestPropertyValues.of("FOO_BAR=BAZ").applyTo(this.environment, Type.SYSTEM_ENVIRONMENT);
57+
TestPropertyValues.of("FOO_BAR=BAZ").applyTo(this.environment,
58+
Type.SYSTEM_ENVIRONMENT);
5859
assertThat(this.environment.getProperty("foo.bar")).isEqualTo("BAZ");
5960
assertThat(this.environment.getPropertySources().contains(
6061
"test-" + StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME));
@@ -72,8 +73,8 @@ public void applyToExistingNameAndDifferentTypeShouldOverrideExistingOne()
7273
throws Exception {
7374
TestPropertyValues.of("foo.bar=baz", "hello.world=hi").applyTo(this.environment,
7475
Type.MAP, "other");
75-
TestPropertyValues.of("FOO_BAR=BAZ").applyTo(this.environment, Type.SYSTEM_ENVIRONMENT,
76-
"other");
76+
TestPropertyValues.of("FOO_BAR=BAZ").applyTo(this.environment,
77+
Type.SYSTEM_ENVIRONMENT, "other");
7778
assertThat(this.environment.getPropertySources().get("other"))
7879
.isInstanceOf(SystemEnvironmentPropertySource.class);
7980
assertThat(this.environment.getProperty("foo.bar")).isEqualTo("BAZ");

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedPropertiesLoader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ private static class CharacterReader implements Closeable {
155155
private int character;
156156

157157
CharacterReader(Resource resource) throws IOException {
158-
this.reader = new LineNumberReader(
159-
new InputStreamReader(resource.getInputStream(), StandardCharsets.ISO_8859_1));
158+
this.reader = new LineNumberReader(new InputStreamReader(
159+
resource.getInputStream(), StandardCharsets.ISO_8859_1));
160160
}
161161

162162
@Override

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,8 @@ private String getProtocols(Connector connector) {
197197

198198
private String getContextPath() {
199199
return Arrays.stream(this.server.getHandlers())
200-
.filter(ContextHandler.class::isInstance)
201-
.map(handler -> ((ContextHandler) handler).getContextPath())
202-
.collect(Collectors.joining(" "));
200+
.filter(ContextHandler.class::isInstance).map(ContextHandler.class::cast)
201+
.map(ContextHandler::getContextPath).collect(Collectors.joining(" "));
203202
}
204203

205204
private void handleDeferredInitialize(Handler... handlers) throws Exception {

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ private HttpServer createHttpServer() {
9191
return HttpServer.builder().options((options) -> {
9292
options.listenAddress(getListenAddress());
9393
if (getSsl() != null && getSsl().isEnabled()) {
94-
SslServerCustomizer sslServerCustomizer = new SslServerCustomizer(getSsl(), getSslStoreProvider());
94+
SslServerCustomizer sslServerCustomizer = new SslServerCustomizer(
95+
getSsl(), getSslStoreProvider());
9596
sslServerCustomizer.customize(options);
9697
}
9798
applyCustomizers(options);

0 commit comments

Comments
 (0)