Browse Source

Polishing

pull/1510/merge
Juergen Hoeller 7 years ago
parent
commit
fd0132c7e6
  1. 8
      spring-test/src/main/java/org/springframework/mock/web/MockPart.java
  2. 11
      spring-web/src/test/java/org/springframework/mock/web/test/MockPart.java
  3. 3
      spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientResponse.java
  4. 2
      spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/AbstractHttpSockJsSession.java

8
spring-test/src/main/java/org/springframework/mock/web/MockPart.java

@ -49,20 +49,22 @@ public class MockPart implements Part { @@ -49,20 +49,22 @@ public class MockPart implements Part {
/**
* Constructor for a part with byte[] content only.
* @see #getHeaders()
*/
public MockPart(String name, byte[] content) {
public MockPart(String name, @Nullable byte[] content) {
this(name, null, content);
}
/**
* Constructor for a part with a filename.
* Constructor for a part with a filename and streamed content.
* @see #getHeaders()
*/
public MockPart(String name, @Nullable String filename, InputStream content) throws IOException {
this(name, filename, FileCopyUtils.copyToByteArray(content));
}
/**
* Constructor for a part with byte[] content only.
* Constructor for a part with a filename and byte[] content.
* @see #getHeaders()
*/
private MockPart(String name, @Nullable String filename, @Nullable byte[] content) {

11
spring-web/src/test/java/org/springframework/mock/web/test/MockPart.java

@ -20,6 +20,7 @@ import java.io.ByteArrayInputStream; @@ -20,6 +20,7 @@ import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import java.util.Collections;
import javax.servlet.http.Part;
import org.springframework.http.HttpHeaders;
@ -27,7 +28,6 @@ import org.springframework.http.MediaType; @@ -27,7 +28,6 @@ import org.springframework.http.MediaType;
import org.springframework.util.Assert;
import org.springframework.util.FileCopyUtils;
/**
* Mock implementation of {@code javax.servlet.http.Part}.
*
@ -47,20 +47,22 @@ public class MockPart implements Part { @@ -47,20 +47,22 @@ public class MockPart implements Part {
/**
* Constructor for a part with byte[] content only.
* @see #getHeaders()
*/
public MockPart(String name, byte[] content) {
this(name, null, content);
}
/**
* Constructor for a part with a filename.
* Constructor for a part with a filename and streamed content.
* @see #getHeaders()
*/
public MockPart(String name, String filename, InputStream content) throws IOException {
this(name, filename, FileCopyUtils.copyToByteArray(content));
}
/**
* Constructor for a part with byte[] content only.
* Constructor for a part with a filename and byte[] content.
* @see #getHeaders()
*/
private MockPart(String name, String filename, byte[] content) {
@ -105,7 +107,8 @@ public class MockPart implements Part { @@ -105,7 +107,8 @@ public class MockPart implements Part {
@Override
public Collection<String> getHeaders(String name) {
return this.headers.get(name);
Collection<String> headerValues = this.headers.get(name);
return (headerValues != null ? headerValues : Collections.emptyList());
}
@Override

3
spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientResponse.java

@ -146,6 +146,7 @@ public interface ClientResponse extends Closeable { @@ -146,6 +146,7 @@ public interface ClientResponse extends Closeable {
@Override
void close();
/**
* Represents the headers of the HTTP response.
* @see ClientResponse#headers()
@ -175,6 +176,6 @@ public interface ClientResponse extends Closeable { @@ -175,6 +176,6 @@ public interface ClientResponse extends Closeable {
* Return the headers as a {@link HttpHeaders} instance.
*/
HttpHeaders asHttpHeaders();
}
}

2
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/AbstractHttpSockJsSession.java

@ -295,7 +295,7 @@ public abstract class AbstractHttpSockJsSession extends AbstractSockJsSession { @@ -295,7 +295,7 @@ public abstract class AbstractHttpSockJsSession extends AbstractSockJsSession {
synchronized (this.responseLock) {
this.messageCache.add(message);
if (logger.isTraceEnabled()) {
logger.trace(this.messageCache.size() + " message(s) to flush in session " + this.getId());
logger.trace(this.messageCache.size() + " message(s) to flush in session " + getId());
}
if (isActive() && this.readyToSend) {
if (logger.isTraceEnabled()) {

Loading…
Cancel
Save