diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java index 25aa8ac85a..4a3a5cfe82 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java @@ -58,7 +58,10 @@ import org.springframework.util.StringUtils; */ public class ReflectivePropertyAccessor implements PropertyAccessor { + private static final Set> ANY_TYPES = Collections.emptySet(); + private static final Set> BOOLEAN_TYPES; + static { Set> booleanTypes = new HashSet>(); booleanTypes.add(Boolean.class); @@ -66,8 +69,6 @@ public class ReflectivePropertyAccessor implements PropertyAccessor { BOOLEAN_TYPES = Collections.unmodifiableSet(booleanTypes); } - private static final Set> ANY_TYPES = Collections.emptySet(); - private final Map readerCache = new ConcurrentHashMap(64); @@ -122,7 +123,7 @@ public class ReflectivePropertyAccessor implements PropertyAccessor { } public Member getLastReadInvokerPair() { - return lastReadInvokerPair.member; + return this.lastReadInvokerPair.member; } @Override diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/messaging/SubProtocolWebSocketHandler.java b/spring-websocket/src/main/java/org/springframework/web/socket/messaging/SubProtocolWebSocketHandler.java index 2d64fede42..2a8f28a585 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/messaging/SubProtocolWebSocketHandler.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/messaging/SubProtocolWebSocketHandler.java @@ -143,12 +143,14 @@ public class SubProtocolWebSocketHandler public void addProtocolHandler(SubProtocolHandler handler) { List protocols = handler.getSupportedProtocols(); if (CollectionUtils.isEmpty(protocols)) { - logger.error("No sub-protocols for " + handler + "."); + if (logger.isErrorEnabled()) { + logger.error("No sub-protocols for " + handler); + } return; } - for (String protocol: protocols) { + for (String protocol : protocols) { SubProtocolHandler replaced = this.protocolHandlerLookup.put(protocol, handler); - if ((replaced != null) && (replaced != handler) ) { + if (replaced != null && replaced != handler) { throw new IllegalStateException("Can't map " + handler + " to protocol '" + protocol + "'. Already mapped to " + replaced + "."); } @@ -316,9 +318,12 @@ public class SubProtocolWebSocketHandler public void handleMessage(Message message) throws MessagingException { String sessionId = resolveSessionId(message); if (sessionId == null) { - logger.error("Couldn't find sessionId in " + message); + if (logger.isErrorEnabled()) { + logger.error("Couldn't find session id in " + message); + } return; } + WebSocketSessionHolder holder = this.sessions.get(sessionId); if (holder == null) { if (logger.isDebugEnabled()) { @@ -327,6 +332,7 @@ public class SubProtocolWebSocketHandler } return; } + WebSocketSession session = holder.getSession(); try { findProtocolHandler(session).handleMessageToClient(session, message); @@ -344,9 +350,11 @@ public class SubProtocolWebSocketHandler logger.debug("Failure while closing session " + sessionId + ".", secondException); } } - catch (Exception e) { + catch (Exception ex) { // Could be part of normal workflow (e.g. browser tab closed) - logger.debug("Failed to send message to client in " + session + ": " + message, e); + if (logger.isDebugEnabled()) { + logger.debug("Failed to send message to client in " + session + ": " + message, ex); + } } }