Enable ModifierOrderCheck Checkstyle rule (#2673)

* Enable ModifierOrderCheck Checkstyle rule

* Fix violations for `static` and `abstract` modifier
* Remove redundant code in the `TcpNioConnection`
* Mark `connectionFactoryName` as `@Nullable` in the `TcpConnectionSupport`
ctor and its inheritors
* Fix some smells according IDEA suggestions in the affected classes
* This should fix some Sonar smells as well

* * Fix `HeaderMapperTests`

* * Polishing `TcpConnection` code style and fix Javdocs
This commit is contained in:
Artem Bilan
2018-12-20 19:19:47 -05:00
committed by Gary Russell
parent a01d09f0f1
commit 93d7c58b64
56 changed files with 633 additions and 563 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2018 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.
@@ -28,10 +28,11 @@ import org.springframework.integration.mapping.HeaderMapper;
* @author Mark Fisher
* @author Oleg Zhurakousky
* @author Gary Russell
* @author Artem Bilan
*/
public abstract class JmsHeaderMapper implements HeaderMapper<Message> {
protected final static String CONTENT_TYPE_PROPERTY = "content_type";
protected static final String CONTENT_TYPE_PROPERTY = "content_type";
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2018 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.
@@ -33,21 +33,23 @@ import org.springframework.util.StringUtils;
* @author Mark Fisher
* @author Oleg Zhurakusky
* @author Gary Russell
* @author Artem Bilan
*
* @since 2.0
*/
public class JmsChannelParser extends AbstractChannelParser {
private final static String CONTAINER_TYPE_ATTRIBUTE = "container-type";
private static final String CONTAINER_TYPE_ATTRIBUTE = "container-type";
private final static String CONTAINER_CLASS_ATTRIBUTE = "container-class";
private static final String CONTAINER_CLASS_ATTRIBUTE = "container-class";
private final static String ACKNOWLEDGE_ATTRIBUTE = "acknowledge";
private static final String ACKNOWLEDGE_ATTRIBUTE = "acknowledge";
@Override
protected BeanDefinitionBuilder buildBeanDefinition(Element element, ParserContext parserContext) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(
JmsChannelFactoryBean.class);
BeanDefinitionBuilder builder =
BeanDefinitionBuilder.genericBeanDefinition(JmsChannelFactoryBean.class);
String messageDriven = element.getAttribute("message-driven");
if (StringUtils.hasText(messageDriven)) {
builder.addConstructorArgValue(messageDriven);
@@ -129,13 +131,15 @@ public class JmsChannelParser extends AbstractChannelParser {
return builder;
}
private void parseDestination(Element element, ParserContext parserContext, BeanDefinitionBuilder builder, String type) {
private void parseDestination(Element element, ParserContext parserContext, BeanDefinitionBuilder builder,
String type) {
boolean isPubSub = "topic".equals(type);
String ref = element.getAttribute(type);
String name = element.getAttribute(type + "-name");
boolean isReference = StringUtils.hasText(ref);
boolean isName = StringUtils.hasText(name);
if (!(isReference ^ isName)) {
if (isReference == isName) {
parserContext.getReaderContext().error("Exactly one of the '" + type +
"' or '" + type + "-name' attributes is required.", element);
}
@@ -152,7 +156,8 @@ public class JmsChannelParser extends AbstractChannelParser {
}
if (isPubSub) {
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "durable", "subscriptionDurable");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "subscription", "durableSubscriptionName");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "subscription",
"durableSubscriptionName");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "subscription-shared");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "client-id");
}
@@ -181,4 +186,5 @@ public class JmsChannelParser extends AbstractChannelParser {
return null;
}
}
}