Polishing

This commit is contained in:
Juergen Hoeller
2017-01-24 00:12:53 +01:00
parent cb242894a9
commit 12973ac702
3 changed files with 73 additions and 72 deletions

View File

@@ -1324,9 +1324,7 @@ configure(rootProject) {
doFirst {
classpath = files(
// ensure Servlet 3.x has precedence on the javadoc classpath
project(":spring-webmvc").sourceSets.main.compileClasspath.files.find { it =~ "servlet-api" },
// ensure the javadoc process can resolve types compiled from .aj sources
// Ensure the javadoc process can resolve types compiled from .aj sources
project(":spring-aspects").sourceSets.main.output
)
classpath += files(subprojects.collect { it.sourceSets.main.compileClasspath })

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@@ -973,7 +973,7 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
private static class VoidCallable implements Callable<Void> {
@Override
public Void call() {
public Void call() throws Exception {
return null;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@@ -37,7 +37,8 @@ public class SockJsFrame {
private static final SockJsFrame CLOSE_GO_AWAY_FRAME = closeFrame(3000, "Go away!");
private static final SockJsFrame CLOSE_ANOTHER_CONNECTION_OPEN_FRAME = closeFrame(2010, "Another connection still open");
private static final SockJsFrame CLOSE_ANOTHER_CONNECTION_OPEN_FRAME =
closeFrame(2010, "Another connection still open");
private final SockJsFrameType type;
@@ -47,10 +48,10 @@ public class SockJsFrame {
/**
* Create a new instance frame with the given frame content.
* @param content the content, must be a non-empty and represent a valid SockJS frame
* @param content the content (must be a non-empty and represent a valid SockJS frame)
*/
public SockJsFrame(String content) {
Assert.hasText(content);
Assert.hasText(content, "Content must not be empty");
if ("o".equals(content)) {
this.type = SockJsFrameType.OPEN;
this.content = content;
@@ -72,10 +73,74 @@ public class SockJsFrame {
this.content = (content.length() > 1 ? content : "c[]");
}
else {
throw new IllegalArgumentException("Unexpected SockJS frame type in content=\"" + content + "\"");
throw new IllegalArgumentException("Unexpected SockJS frame type in content \"" + content + "\"");
}
}
/**
* Return the SockJS frame type.
*/
public SockJsFrameType getType() {
return this.type;
}
/**
* Return the SockJS frame content (never {@code null}).
*/
public String getContent() {
return this.content;
}
/**
* Return the SockJS frame content as a byte array.
*/
public byte[] getContentBytes() {
return this.content.getBytes(CHARSET);
}
/**
* Return data contained in a SockJS "message" and "close" frames. Otherwise
* for SockJS "open" and "close" frames, which do not contain data, return
* {@code null}.
*/
public String getFrameData() {
if (getType() == SockJsFrameType.OPEN || getType() == SockJsFrameType.HEARTBEAT) {
return null;
}
else {
return getContent().substring(1);
}
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(other instanceof SockJsFrame)) {
return false;
}
SockJsFrame otherFrame = (SockJsFrame) other;
return (this.type.equals(otherFrame.type) && this.content.equals(otherFrame.content));
}
@Override
public int hashCode() {
return this.content.hashCode();
}
@Override
public String toString() {
String result = this.content;
if (result.length() > 80) {
result = result.substring(0, 80) + "...(truncated)";
}
return "SockJsFrame content='" + result.replace("\n", "\\n").replace("\r", "\\r") + "'";
}
public static SockJsFrame openFrame() {
return OPEN_FRAME;
}
@@ -101,66 +166,4 @@ public class SockJsFrame {
return new SockJsFrame("c[" + code + ",\"" + reason + "\"]");
}
/**
* Return the SockJS frame type.
*/
public SockJsFrameType getType() {
return this.type;
}
/**
* Return the SockJS frame content, never {@code null}.
*/
public String getContent() {
return this.content;
}
/**
* Return the SockJS frame content as a byte array.
*/
public byte[] getContentBytes() {
return this.content.getBytes(CHARSET);
}
/**
* Return data contained in a SockJS "message" and "close" frames. Otherwise
* for SockJS "open" and "close" frames, which do not contain data, return
* {@code null}.
*/
public String getFrameData() {
if (SockJsFrameType.OPEN == getType() || SockJsFrameType.HEARTBEAT == getType()) {
return null;
}
else {
return getContent().substring(1);
}
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(other instanceof SockJsFrame)) {
return false;
}
return (this.type.equals(((SockJsFrame) other).type) && this.content.equals(((SockJsFrame) other).content));
}
@Override
public int hashCode() {
return this.content.hashCode();
}
@Override
public String toString() {
String result = this.content;
if (result.length() > 80) {
result = result.substring(0, 80) + "...(truncated)";
}
return "SockJsFrame content='" + result.replace("\n", "\\n").replace("\r", "\\r") + "'";
}
}