From 0c45c4c6a3509dad66a38e20dcc25fdb3a036901 Mon Sep 17 00:00:00 2001 From: igor-suhorukov Date: Thu, 8 Mar 2018 23:45:35 +0300 Subject: [PATCH] lamdbas containing only one statement should not nest this statement in a block --- .../org/springframework/core/io/buffer/DataBufferUtils.java | 5 ++--- .../web/reactive/resource/ResourceUrlProvider.java | 5 ++--- .../reactive/result/method/annotation/ModelInitializer.java | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/io/buffer/DataBufferUtils.java b/spring-core/src/main/java/org/springframework/core/io/buffer/DataBufferUtils.java index a38e11bea1..cb5daf76b6 100644 --- a/spring-core/src/main/java/org/springframework/core/io/buffer/DataBufferUtils.java +++ b/spring-core/src/main/java/org/springframework/core/io/buffer/DataBufferUtils.java @@ -363,9 +363,8 @@ public abstract class DataBufferUtils { Assert.isTrue(position >= 0, "'position' must be >= 0"); Flux flux = Flux.from(source); - return Flux.create(sink -> { - flux.subscribe(new AsynchronousFileChannelWriteCompletionHandler(sink, channel, position)); - }); + return Flux.create(sink -> + flux.subscribe(new AsynchronousFileChannelWriteCompletionHandler(sink, channel, position))); } private static void closeChannel(@Nullable Channel channel) { diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceUrlProvider.java b/spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceUrlProvider.java index 3e5c2add98..3a54aeaf9c 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceUrlProvider.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceUrlProvider.java @@ -100,7 +100,7 @@ public class ResourceUrlProvider implements ApplicationListener mappings = new ArrayList<>(beans.values()); AnnotationAwareOrderComparator.sort(mappings); - mappings.forEach(mapping -> { + mappings.forEach(mapping -> mapping.getHandlerMap().forEach((pattern, handler) -> { if (handler instanceof ResourceWebHandler) { ResourceWebHandler resourceHandler = (ResourceWebHandler) handler; @@ -111,8 +111,7 @@ public class ResourceUrlProvider implements ApplicationListener { + .doOnSuccess(aVoid -> findModelAttributes(handlerMethod, sessionAttributesHandler).forEach(name -> { if (!bindingContext.getModel().containsAttribute(name)) { Object value = session.getRequiredAttribute(name); bindingContext.getModel().addAttribute(name, value); } - }); - }); + })); }); }