Skip to content

Commit 12973ac

Browse files
committed
Polishing
1 parent cb24289 commit 12973ac

File tree

3 files changed

+39
-38
lines changed

3 files changed

+39
-38
lines changed

build.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,9 +1324,7 @@ configure(rootProject) {
13241324

13251325
doFirst {
13261326
classpath = files(
1327-
// ensure Servlet 3.x has precedence on the javadoc classpath
1328-
project(":spring-webmvc").sourceSets.main.compileClasspath.files.find { it =~ "servlet-api" },
1329-
// ensure the javadoc process can resolve types compiled from .aj sources
1327+
// Ensure the javadoc process can resolve types compiled from .aj sources
13301328
project(":spring-aspects").sourceSets.main.output
13311329
)
13321330
classpath += files(subprojects.collect { it.sourceSets.main.compileClasspath })

spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -973,7 +973,7 @@ public ListenableFuture<Void> forward(Message<?> message, StompHeaderAccessor ac
973973
private static class VoidCallable implements Callable<Void> {
974974

975975
@Override
976-
public Void call() {
976+
public Void call() throws Exception {
977977
return null;
978978
}
979979
}

spring-websocket/src/main/java/org/springframework/web/socket/sockjs/frame/SockJsFrame.java

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -37,7 +37,8 @@ public class SockJsFrame {
3737

3838
private static final SockJsFrame CLOSE_GO_AWAY_FRAME = closeFrame(3000, "Go away!");
3939

40-
private static final SockJsFrame CLOSE_ANOTHER_CONNECTION_OPEN_FRAME = closeFrame(2010, "Another connection still open");
40+
private static final SockJsFrame CLOSE_ANOTHER_CONNECTION_OPEN_FRAME =
41+
closeFrame(2010, "Another connection still open");
4142

4243

4344
private final SockJsFrameType type;
@@ -47,10 +48,10 @@ public class SockJsFrame {
4748

4849
/**
4950
* Create a new instance frame with the given frame content.
50-
* @param content the content, must be a non-empty and represent a valid SockJS frame
51+
* @param content the content (must be a non-empty and represent a valid SockJS frame)
5152
*/
5253
public SockJsFrame(String content) {
53-
Assert.hasText(content);
54+
Assert.hasText(content, "Content must not be empty");
5455
if ("o".equals(content)) {
5556
this.type = SockJsFrameType.OPEN;
5657
this.content = content;
@@ -72,35 +73,10 @@ else if (content.charAt(0) == 'c') {
7273
this.content = (content.length() > 1 ? content : "c[]");
7374
}
7475
else {
75-
throw new IllegalArgumentException("Unexpected SockJS frame type in content=\"" + content + "\"");
76+
throw new IllegalArgumentException("Unexpected SockJS frame type in content \"" + content + "\"");
7677
}
7778
}
7879

79-
public static SockJsFrame openFrame() {
80-
return OPEN_FRAME;
81-
}
82-
83-
public static SockJsFrame heartbeatFrame() {
84-
return HEARTBEAT_FRAME;
85-
}
86-
87-
public static SockJsFrame messageFrame(SockJsMessageCodec codec, String... messages) {
88-
String encoded = codec.encode(messages);
89-
return new SockJsFrame(encoded);
90-
}
91-
92-
public static SockJsFrame closeFrameGoAway() {
93-
return CLOSE_GO_AWAY_FRAME;
94-
}
95-
96-
public static SockJsFrame closeFrameAnotherConnectionOpen() {
97-
return CLOSE_ANOTHER_CONNECTION_OPEN_FRAME;
98-
}
99-
100-
public static SockJsFrame closeFrame(int code, String reason) {
101-
return new SockJsFrame("c[" + code + ",\"" + reason + "\"]");
102-
}
103-
10480

10581
/**
10682
* Return the SockJS frame type.
@@ -110,7 +86,7 @@ public SockJsFrameType getType() {
11086
}
11187

11288
/**
113-
* Return the SockJS frame content, never {@code null}.
89+
* Return the SockJS frame content (never {@code null}).
11490
*/
11591
public String getContent() {
11692
return this.content;
@@ -129,7 +105,7 @@ public byte[] getContentBytes() {
129105
* {@code null}.
130106
*/
131107
public String getFrameData() {
132-
if (SockJsFrameType.OPEN == getType() || SockJsFrameType.HEARTBEAT == getType()) {
108+
if (getType() == SockJsFrameType.OPEN || getType() == SockJsFrameType.HEARTBEAT) {
133109
return null;
134110
}
135111
else {
@@ -146,7 +122,8 @@ public boolean equals(Object other) {
146122
if (!(other instanceof SockJsFrame)) {
147123
return false;
148124
}
149-
return (this.type.equals(((SockJsFrame) other).type) && this.content.equals(((SockJsFrame) other).content));
125+
SockJsFrame otherFrame = (SockJsFrame) other;
126+
return (this.type.equals(otherFrame.type) && this.content.equals(otherFrame.content));
150127
}
151128

152129
@Override
@@ -163,4 +140,30 @@ public String toString() {
163140
return "SockJsFrame content='" + result.replace("\n", "\\n").replace("\r", "\\r") + "'";
164141
}
165142

143+
144+
public static SockJsFrame openFrame() {
145+
return OPEN_FRAME;
146+
}
147+
148+
public static SockJsFrame heartbeatFrame() {
149+
return HEARTBEAT_FRAME;
150+
}
151+
152+
public static SockJsFrame messageFrame(SockJsMessageCodec codec, String... messages) {
153+
String encoded = codec.encode(messages);
154+
return new SockJsFrame(encoded);
155+
}
156+
157+
public static SockJsFrame closeFrameGoAway() {
158+
return CLOSE_GO_AWAY_FRAME;
159+
}
160+
161+
public static SockJsFrame closeFrameAnotherConnectionOpen() {
162+
return CLOSE_ANOTHER_CONNECTION_OPEN_FRAME;
163+
}
164+
165+
public static SockJsFrame closeFrame(int code, String reason) {
166+
return new SockJsFrame("c[" + code + ",\"" + reason + "\"]");
167+
}
168+
166169
}

0 commit comments

Comments
 (0)