Browse Source

Polish: lamdbas containing only one statement should not nest this statement in a block

pull/1684/head
igor-suhorukov 7 years ago committed by Juergen Hoeller
parent
commit
7826567df6
  1. 4
      spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java
  2. 12
      spring-jms/src/main/java/org/springframework/jms/core/JmsTemplate.java
  3. 4
      spring-web/src/main/java/org/springframework/http/codec/xml/XmlEventDecoder.java
  4. 6
      spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ExchangeFilterFunctions.java
  5. 4
      spring-webflux/src/main/java/org/springframework/web/reactive/function/server/support/RouterFunctionMapping.java

4
spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java vendored

@ -347,9 +347,7 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker @@ -347,9 +347,7 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
Object key = generateKey(context, CacheOperationExpressionEvaluator.NO_RESULT);
Cache cache = context.getCaches().iterator().next();
try {
return wrapCacheValue(method, cache.get(key, () -> {
return unwrapReturnValue(invokeOperation(invoker));
}));
return wrapCacheValue(method, cache.get(key, () -> unwrapReturnValue(invokeOperation(invoker))));
}
catch (Cache.ValueRetrievalException ex) {
// The invoker wraps any Throwable in a ThrowableWrapper instance so we

12
spring-jms/src/main/java/org/springframework/jms/core/JmsTemplate.java

@ -653,16 +653,12 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations @@ -653,16 +653,12 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
@Override
public void convertAndSend(Destination destination, final Object message) throws JmsException {
send(destination, session -> {
return getRequiredMessageConverter().toMessage(message, session);
});
send(destination, session -> getRequiredMessageConverter().toMessage(message, session));
}
@Override
public void convertAndSend(String destinationName, final Object message) throws JmsException {
send(destinationName, session -> {
return getRequiredMessageConverter().toMessage(message, session);
});
send(destinationName, session -> getRequiredMessageConverter().toMessage(message, session));
}
@Override
@ -742,9 +738,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations @@ -742,9 +738,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
@Override
@Nullable
public Message receiveSelected(final Destination destination, @Nullable final String messageSelector) throws JmsException {
return execute(session -> {
return doReceive(session, destination, messageSelector);
}, true);
return execute(session -> doReceive(session, destination, messageSelector), true);
}
@Override

4
spring-web/src/main/java/org/springframework/http/codec/xml/XmlEventDecoder.java

@ -110,9 +110,7 @@ public class XmlEventDecoder extends AbstractDecoder<XMLEvent> { @@ -110,9 +110,7 @@ public class XmlEventDecoder extends AbstractDecoder<XMLEvent> {
InputStream is = dataBuffer.asInputStream();
Iterator eventReader = inputFactory.createXMLEventReader(is);
return Flux.fromIterable((Iterable<XMLEvent>) () -> eventReader)
.doFinally(t -> {
DataBufferUtils.release(dataBuffer);
});
.doFinally(t -> DataBufferUtils.release(dataBuffer));
}
catch (XMLStreamException ex) {
return Mono.error(ex);

6
spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ExchangeFilterFunctions.java

@ -91,10 +91,8 @@ public abstract class ExchangeFilterFunctions { @@ -91,10 +91,8 @@ public abstract class ExchangeFilterFunctions {
clientRequest -> credentialsFunction.apply(clientRequest).map(
credentials -> {
ClientRequest authorizedRequest = ClientRequest.from(clientRequest)
.headers(headers -> {
headers.set(HttpHeaders.AUTHORIZATION,
authorization(credentials));
})
.headers(headers -> headers.set(HttpHeaders.AUTHORIZATION,
authorization(credentials)))
.build();
return Mono.just(authorizedRequest);
})

4
spring-webflux/src/main/java/org/springframework/web/reactive/function/server/support/RouterFunctionMapping.java

@ -114,9 +114,7 @@ public class RouterFunctionMapping extends AbstractHandlerMapping implements Ini @@ -114,9 +114,7 @@ public class RouterFunctionMapping extends AbstractHandlerMapping implements Ini
List<RouterFunction<?>> routerFunctions = routerFunctions();
if (!CollectionUtils.isEmpty(routerFunctions) && logger.isInfoEnabled()) {
routerFunctions.forEach(routerFunction -> {
logger.info("Mapped " + routerFunction);
});
routerFunctions.forEach(routerFunction -> logger.info("Mapped " + routerFunction));
}
this.routerFunction = routerFunctions.stream()
.reduce(RouterFunction::andOther)

Loading…
Cancel
Save