Add EmptyLineSeparator Checkstyle rule

* Support "blank lines around" via `spring-framework.xml` IDEA config
* Fix all the Checkstyle violations
This commit is contained in:
Artem Bilan
2024-03-27 16:54:25 -04:00
parent f71a2234d8
commit c155d5d418
932 changed files with 1341 additions and 2485 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2023 the original author or authors.
* Copyright 2015-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -369,7 +369,6 @@ public abstract class AbstractStompSessionManager implements StompSessionManager
protected abstract CompletableFuture<StompSession> doConnect(StompSessionHandler handler);
private class CompositeStompSessionHandler extends StompSessionHandlerAdapter {
private final List<StompSessionHandler> delegates = Collections.synchronizedList(new ArrayList<>());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2023 the original author or authors.
* Copyright 2015-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -204,38 +204,8 @@ public class StompInboundChannelAdapter extends MessageProducerSupport implement
private void subscribeDestination(final String destination) {
if (this.stompSession != null) {
class FrameHandler implements StompFrameHandler {
@Override
public Type getPayloadType(StompHeaders headers) {
return StompInboundChannelAdapter.this.payloadType;
}
@Override
public void handleFrame(StompHeaders headers, @Nullable Object body) {
Message<?> message;
if (body == null) {
logger.info("No body in STOMP frame: nothing to produce.");
return;
}
else if (body instanceof Message) {
message = (Message<?>) body;
}
else {
message =
getMessageBuilderFactory()
.withPayload(body)
.copyHeaders(
StompInboundChannelAdapter.this.headerMapper.toHeaders(headers))
.build();
}
sendMessage(message);
}
}
final StompSession.Subscription subscription =
this.stompSession.subscribe(destination, new FrameHandler());
StompSession.Subscription subscription =
this.stompSession.subscribe(destination, new IntegrationFrameHandler());
if (this.stompSessionManager.isAutoReceiptEnabled()) {
final ApplicationEventPublisher eventPublisher = this.applicationEventPublisher;
@@ -268,6 +238,9 @@ public class StompInboundChannelAdapter extends MessageProducerSupport implement
private final class IntegrationInboundStompSessionHandler extends StompSessionHandlerAdapter {
IntegrationInboundStompSessionHandler() {
}
@Override
public void afterConnected(StompSession session, StompHeaders connectedHeaders) {
StompInboundChannelAdapter.this.stompSession = session;
@@ -307,4 +280,38 @@ public class StompInboundChannelAdapter extends MessageProducerSupport implement
}
private final class IntegrationFrameHandler implements StompFrameHandler {
IntegrationFrameHandler() {
}
@Override
public Type getPayloadType(StompHeaders headers) {
return StompInboundChannelAdapter.this.payloadType;
}
@Override
public void handleFrame(StompHeaders headers, @Nullable Object body) {
Message<?> message;
if (body == null) {
logger.info("No body in STOMP frame: nothing to produce.");
return;
}
else if (body instanceof Message) {
message = (Message<?>) body;
}
else {
message =
getMessageBuilderFactory()
.withPayload(body)
.copyHeaders(
StompInboundChannelAdapter.this.headerMapper.toHeaders(headers))
.build();
}
sendMessage(message);
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2021 the original author or authors.
* Copyright 2015-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -234,7 +234,6 @@ public class StompHeaderMapper implements HeaderMapper<StompHeaders> {
return target;
}
private static boolean shouldMapHeader(String headerName, String[] patterns) {
if (patterns != null && patterns.length > 0) {
for (String pattern : patterns) {

View File

@@ -209,7 +209,6 @@ public class StompServerIntegrationTests {
}
while (!(eventMessage.getPayload() instanceof StompConnectionFailedEvent) && n++ < 100);
assertThatExceptionOfType(MessageDeliveryException.class)
.isThrownBy(() -> stompOutputChannel1.send(new GenericMessage<>("foo".getBytes())))
.withMessageContaining("could not deliver message");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2023 the original author or authors.
* Copyright 2015-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -107,7 +107,6 @@ public class StompInboundChannelAdapterWebSocketIntegrationTests {
@Autowired
private StompInboundChannelAdapter stompInboundChannelAdapter;
@Test
public void testWebSocketStompClient() throws Exception {
Message<?> eventMessage = this.stompEvents.receive(10000);
@@ -220,7 +219,6 @@ public class StompInboundChannelAdapterWebSocketIntegrationTests {
.isTrue();
}
private boolean containsDestination(String destination, SubscriptionRegistry subscriptionRegistry) {
StompHeaderAccessor stompHeaderAccessor = StompHeaderAccessor.create(StompCommand.MESSAGE);
stompHeaderAccessor.setDestination(destination);
@@ -229,7 +227,6 @@ public class StompInboundChannelAdapterWebSocketIntegrationTests {
return !subscriptions.isEmpty();
}
// STOMP Client
@Configuration
@@ -248,7 +245,7 @@ public class StompInboundChannelAdapterWebSocketIntegrationTests {
@Bean
public WebSocketStompClient stompClient(
@Qualifier("taskScheduler") TaskScheduler taskScheduler) {
@Qualifier("taskScheduler") TaskScheduler taskScheduler) {
WebSocketStompClient webSocketStompClient = new WebSocketStompClient(webSocketClient());
webSocketStompClient.setMessageConverter(new MappingJackson2MessageConverter());
webSocketStompClient.setTaskScheduler(taskScheduler);
@@ -348,8 +345,7 @@ public class StompInboundChannelAdapterWebSocketIntegrationTests {
//SimpleBrokerMessageHandler doesn't support RECEIPT frame, hence we emulate it this way
@Bean
public ApplicationListener<SessionSubscribeEvent> webSocketEventListener(
@Qualifier("clientOutboundChannel")
final AbstractSubscribableChannel clientOutboundChannel) {
@Qualifier("clientOutboundChannel") final AbstractSubscribableChannel clientOutboundChannel) {
return event -> {
Message<byte[]> message = event.getMessage();
StompHeaderAccessor stompHeaderAccessor = StompHeaderAccessor.wrap(message);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2022 the original author or authors.
* Copyright 2015-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -260,7 +260,6 @@ public class StompMessageHandlerWebSocketIntegrationTests {
configurer.enableSimpleBroker("/topic", "/queue");
}
@Override
public void configureClientInboundChannel(ChannelRegistration registration) {
registration.interceptors(new ChannelInterceptor() {