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 2014 the original author or authors.
* Copyright 2014-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.
@@ -38,16 +38,17 @@ import org.springframework.web.socket.messaging.SubProtocolHandler;
*
* @author Andy Wilkinson
* @author Artem Bilan
*
* @since 4.1
*
* @see org.springframework.integration.websocket.inbound.WebSocketInboundChannelAdapter
* @see org.springframework.integration.websocket.outbound.WebSocketOutboundMessageHandler
*/
public final class SubProtocolHandlerRegistry {
private final static Log logger = LogFactory.getLog(SubProtocolHandlerRegistry.class);
private static final Log logger = LogFactory.getLog(SubProtocolHandlerRegistry.class);
private final Map<String, SubProtocolHandler> protocolHandlers =
new TreeMap<String, SubProtocolHandler>(String.CASE_INSENSITIVE_ORDER);
private final Map<String, SubProtocolHandler> protocolHandlers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
private final SubProtocolHandler defaultProtocolHandler;
@@ -68,7 +69,9 @@ public final class SubProtocolHandlerRegistry {
for (SubProtocolHandler handler : protocolHandlers) {
List<String> protocols = handler.getSupportedProtocols();
if (CollectionUtils.isEmpty(protocols)) {
logger.warn("No sub-protocols, ignoring handler " + handler);
if (logger.isWarnEnabled()) {
logger.warn("No sub-protocols, ignoring handler " + handler);
}
continue;
}
for (String protocol : protocols) {
@@ -112,7 +115,7 @@ public final class SubProtocolHandlerRegistry {
if (StringUtils.hasText(protocol)) {
handler = this.protocolHandlers.get(protocol);
Assert.state(handler != null,
"No handler for sub-protocol '" + protocol + "', handlers = " + this.protocolHandlers);
() -> "No handler for sub-protocol '" + protocol + "', handlers = " + this.protocolHandlers);
}
else {
handler = this.defaultProtocolHandler;