Skip to content

Commit 21329df

Browse files
committed
Polishing
1 parent bdb606b commit 21329df

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,17 @@
5858
*/
5959
public class ReflectivePropertyAccessor implements PropertyAccessor {
6060

61+
private static final Set<Class<?>> ANY_TYPES = Collections.emptySet();
62+
6163
private static final Set<Class<?>> BOOLEAN_TYPES;
64+
6265
static {
6366
Set<Class<?>> booleanTypes = new HashSet<Class<?>>();
6467
booleanTypes.add(Boolean.class);
6568
booleanTypes.add(Boolean.TYPE);
6669
BOOLEAN_TYPES = Collections.unmodifiableSet(booleanTypes);
6770
}
6871

69-
private static final Set<Class<?>> ANY_TYPES = Collections.emptySet();
70-
7172

7273
private final Map<CacheKey, InvokerPair> readerCache = new ConcurrentHashMap<CacheKey, InvokerPair>(64);
7374

@@ -122,7 +123,7 @@ public boolean canRead(EvaluationContext context, Object target, String name) th
122123
}
123124

124125
public Member getLastReadInvokerPair() {
125-
return lastReadInvokerPair.member;
126+
return this.lastReadInvokerPair.member;
126127
}
127128

128129
@Override

spring-websocket/src/main/java/org/springframework/web/socket/messaging/SubProtocolWebSocketHandler.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,14 @@ public List<SubProtocolHandler> getProtocolHandlers() {
143143
public void addProtocolHandler(SubProtocolHandler handler) {
144144
List<String> protocols = handler.getSupportedProtocols();
145145
if (CollectionUtils.isEmpty(protocols)) {
146-
logger.error("No sub-protocols for " + handler + ".");
146+
if (logger.isErrorEnabled()) {
147+
logger.error("No sub-protocols for " + handler);
148+
}
147149
return;
148150
}
149-
for (String protocol: protocols) {
151+
for (String protocol : protocols) {
150152
SubProtocolHandler replaced = this.protocolHandlerLookup.put(protocol, handler);
151-
if ((replaced != null) && (replaced != handler) ) {
153+
if (replaced != null && replaced != handler) {
152154
throw new IllegalStateException("Can't map " + handler +
153155
" to protocol '" + protocol + "'. Already mapped to " + replaced + ".");
154156
}
@@ -316,9 +318,12 @@ public void handleMessage(WebSocketSession session, WebSocketMessage<?> message)
316318
public void handleMessage(Message<?> message) throws MessagingException {
317319
String sessionId = resolveSessionId(message);
318320
if (sessionId == null) {
319-
logger.error("Couldn't find sessionId in " + message);
321+
if (logger.isErrorEnabled()) {
322+
logger.error("Couldn't find session id in " + message);
323+
}
320324
return;
321325
}
326+
322327
WebSocketSessionHolder holder = this.sessions.get(sessionId);
323328
if (holder == null) {
324329
if (logger.isDebugEnabled()) {
@@ -327,6 +332,7 @@ public void handleMessage(Message<?> message) throws MessagingException {
327332
}
328333
return;
329334
}
335+
330336
WebSocketSession session = holder.getSession();
331337
try {
332338
findProtocolHandler(session).handleMessageToClient(session, message);
@@ -344,9 +350,11 @@ public void handleMessage(Message<?> message) throws MessagingException {
344350
logger.debug("Failure while closing session " + sessionId + ".", secondException);
345351
}
346352
}
347-
catch (Exception e) {
353+
catch (Exception ex) {
348354
// Could be part of normal workflow (e.g. browser tab closed)
349-
logger.debug("Failed to send message to client in " + session + ": " + message, e);
355+
if (logger.isDebugEnabled()) {
356+
logger.debug("Failed to send message to client in " + session + ": " + message, ex);
357+
}
350358
}
351359
}
352360

0 commit comments

Comments
 (0)