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 2002-2022 the original author or authors.
* Copyright 2002-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.
@@ -119,13 +119,11 @@ public class HttpInboundEndpointParser extends AbstractSingleBeanDefinitionParse
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "message-converters");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "merge-with-default-converters");
parseHeaderMapper(element, parserContext, builder);
BeanDefinition requestMappingDef = createRequestMapping(element);
builder.addPropertyValue("requestMapping", requestMappingDef);
parseCrossOrigin(element, builder);
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element,

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-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.
@@ -54,7 +54,6 @@ public class MultipartAwareFormHttpMessageConverter implements HttpMessageConver
private MultipartFileReader<?> multipartFileReader = new DefaultMultipartFileReader();
/**
* Set the character set used for writing form data.
* @param charset The charset.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-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.
@@ -43,13 +43,11 @@ public class SerializingHttpMessageConverter extends AbstractHttpMessageConverte
private static final MediaType APPLICATION_JAVA_SERIALIZED_OBJECT =
new MediaType("application", "x-java-serialized-object");
/** Creates a new instance of the {@code SerializingHttpMessageConverter}. */
public SerializingHttpMessageConverter() {
super(APPLICATION_JAVA_SERIALIZED_OBJECT);
}
@Override
public boolean supports(Class<?> clazz) {
return Serializable.class.isAssignableFrom(clazz);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 the original author or authors.
* Copyright 2017-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.
@@ -178,7 +178,6 @@ public abstract class BaseHttpMessageHandlerSpec<S extends BaseHttpMessageHandle
return expectedResponseTypeExpression(new FunctionExpression<>(expectedResponseTypeFunction));
}
/**
* Set the {@link HeaderMapper} to use when mapping between HTTP headers and {@code MessageHeaders}.
* @param headerMapper The header mapper.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-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.
@@ -190,7 +190,6 @@ public abstract class HttpRequestHandlingEndpointSupport extends BaseHttpInbound
return this.messageConverters;
}
/**
* Flag which determines if the default converters should be available after
* custom converters.
@@ -200,7 +199,6 @@ public abstract class HttpRequestHandlingEndpointSupport extends BaseHttpInbound
this.mergeWithDefaultConverters = mergeWithDefaultConverters;
}
/**
* Specify the {@link MultipartResolver} to use when checking requests. If no resolver is provided, the
* "multipartResolver" bean in the context will be used as a fallback. If that is not available either, this

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-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.
@@ -71,7 +71,6 @@ public class HttpRequestHandlingMessagingGateway extends HttpRequestHandlingEndp
private volatile boolean convertExceptions;
public HttpRequestHandlingMessagingGateway() {
this(true);
}
@@ -80,7 +79,6 @@ public class HttpRequestHandlingMessagingGateway extends HttpRequestHandlingEndp
super(expectReply);
}
/**
* Flag to determine if conversion and writing out of message handling exceptions should be attempted (default
* false, in which case they will simply be re-thrown). If the flag is true and no message converter can convert the

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-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.
@@ -38,14 +38,12 @@ public class FileCopyingMultipartFileReader implements MultipartFileReader<Multi
private static final Log LOGGER = LogFactory.getLog(FileCopyingMultipartFileReader.class);
private final File directory;
private String prefix = "si_";
private String suffix = ".tmp";
/**
* Create a {@link FileCopyingMultipartFileReader} that creates temporary
* Files in the default temporary directory.
@@ -63,7 +61,6 @@ public class FileCopyingMultipartFileReader implements MultipartFileReader<Multi
this.directory = directory;
}
/**
* Specify the prefix to use for temporary files.
* @param prefix The prefix.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-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.
@@ -38,13 +38,11 @@ public class MultipartHttpInputMessage extends ServletServerHttpRequest implemen
private final MultipartHttpServletRequest multipartServletRequest;
public MultipartHttpInputMessage(MultipartHttpServletRequest multipartServletRequest) {
super(multipartServletRequest);
this.multipartServletRequest = multipartServletRequest;
}
public MultipartFile getFile(String name) {
return this.multipartServletRequest.getFile(name);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-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.
@@ -36,7 +36,6 @@ public class SimpleMultipartFileReader implements MultipartFileReader<Object> {
private volatile Charset defaultCharset = Charset.forName(WebUtils.DEFAULT_CHARACTER_ENCODING);
/**
* Specify the default charset name to use when converting multipart file
* content into Strings if the multipart itself does not provide a charset.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-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.
@@ -49,7 +49,6 @@ public class UploadedMultipartFile implements MultipartFile {
private final String originalFilename;
public UploadedMultipartFile(File file, long size, String contentType, String formParameterName,
String originalFilename) {
Assert.notNull(file, "file must not be null");
@@ -78,7 +77,6 @@ public class UploadedMultipartFile implements MultipartFile {
this.originalFilename = originalFilename;
}
@Override
public String getName() {
return this.formParameterName;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019 the original author or authors.
* Copyright 2019-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.
@@ -47,7 +47,6 @@ public class IntegrationWebExchangeBindException extends WebExchangeBindExceptio
this.failedPayload = failedPayload;
}
@Override
public String getMessage() {
BindingResult bindingResult = getBindingResult();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-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.
@@ -37,7 +37,6 @@ public class StubMultipartFile implements MultipartFile {
private final String text;
public StubMultipartFile(String parameterName, String filename, String text) {
this.parameterName = parameterName;
this.filename = filename;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-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.
@@ -32,7 +32,6 @@ import org.springframework.core.io.InputStreamResource;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
/**
* @author Gunnar Hillert
* @author Artem Bilan

View File

@@ -46,7 +46,6 @@ public class DefaultConfigurationTests {
@Autowired
private ApplicationContext context;
@Test
public void verifyErrorChannel() {
Object errorChannel = context.getBean("errorChannel");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-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.
@@ -57,7 +57,6 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.willReturn;
/**
* @author Mark Fisher
* @author Oleg Zhurakousky
@@ -248,7 +247,6 @@ public class HttpInboundChannelAdapterParserTests extends AbstractHttpInboundTes
assertThat(((TestObject) message.getPayload()).text).isEqualTo("testObject");
}
@Test
public void putOrDeleteMethodsSupported() {
HttpMethod[] supportedMethods =

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-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.
@@ -100,7 +100,6 @@ public class HttpInboundGatewayParserTests {
@Autowired
private PollableChannel responses;
@Test
public void checkConfig() {
assertThat(this.gateway).isNotNull();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-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.
@@ -214,7 +214,6 @@ public class HttpOutboundGatewayParserTests {
assertThat(this.withPoller1).isInstanceOf(PollingConsumer.class);
}
public static class StubErrorHandler implements ResponseErrorHandler {
@Override

View File

@@ -121,7 +121,6 @@ public class HttpDslTests {
.build();
}
@Test
public void testHttpProxyFlow() throws Exception {
ClientHttpRequestFactory mockRequestFactory = new MockMvcClientHttpRequestFactory(this.mockMvc);

View File

@@ -281,6 +281,7 @@ public class HttpRequestHandlingMessagingGatewayTests extends AbstractHttpInboun
gateway.setBeanFactory(mock(BeanFactory.class));
ParameterizedTypeReference<List<TestBean>> parameterizedTypeReference =
new ParameterizedTypeReference<>() {
};
gateway.setRequestPayloadType(ResolvableType.forType(parameterizedTypeReference));
gateway.setRequestChannel(channel);
@@ -313,7 +314,6 @@ public class HttpRequestHandlingMessagingGatewayTests extends AbstractHttpInboun
});
}
@Test
public void INT2680DuplicateContentTypeHeader() throws Exception {
DirectChannel requestChannel = new DirectChannel();
@@ -451,7 +451,6 @@ public class HttpRequestHandlingMessagingGatewayTests extends AbstractHttpInboun
assertThat(response.getContentAsString()).contains("from error channel");
}
@Test
public void testMultipart() throws Exception {
HttpRequestHandlingMessagingGateway gateway = new HttpRequestHandlingMessagingGateway(false);
@@ -500,7 +499,6 @@ public class HttpRequestHandlingMessagingGatewayTests extends AbstractHttpInboun
assertThat(twoValues).containsExactly("2");
}
private static class ContentTypeCheckingMockHttpServletResponse extends MockHttpServletResponse {
private final List<String> contentTypeList = new ArrayList<>();
@@ -547,7 +545,6 @@ public class HttpRequestHandlingMessagingGatewayTests extends AbstractHttpInboun
}
@SuppressWarnings("serial")
public static class TestBean implements Serializable {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-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.
@@ -49,7 +49,6 @@ public class HttpRequestHandlingMessagingGatewayWithPathMappingTests extends Abs
private static final ExpressionParser PARSER = new SpelExpressionParser();
@Test
public void withoutExpression() {
DirectChannel echoChannel = new DirectChannel();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2022 the original author or authors.
* Copyright 2013-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.
@@ -86,7 +86,6 @@ public class Int2312RequestMappingIntegrationTests extends AbstractHttpInboundTe
assertThat(response.getContentAsString()).isEqualTo(TEST_STRING_MULTIPLE_PATHS);
}
@Test
@SuppressWarnings("unchecked")
//INT-1362

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-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.
@@ -70,7 +70,6 @@ public class CookieTests {
ch1.send(new GenericMessage<>("Hello, world!"));
assertThat(ch6.receive()).isNotNull();
bos.close();
BufferedReader br = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(bos.toByteArray())));
String line = br.readLine();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-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.
@@ -635,7 +635,6 @@ public class HttpRequestExecutingMessageHandlerTests {
assertThat(template.lastRequestEntity.get().getHeaders().getContentType()).isNull();
//DELETE
handler.setHttpMethod(HttpMethod.DELETE);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-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.
@@ -497,7 +497,6 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
assertThat(headers.get("X-customHeaderB")).isNull();
}
@Test
public void validateCustomHeadersWithNonStringValuesAndDefaultConverterOnly() {
DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper();
@@ -588,7 +587,6 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
assertThat(result.get(MessageHeaders.CONTENT_TYPE)).isEqualTo(MediaType.valueOf("text/plain"));
}
public static class TestClass {
}