Skip to content

Commit fd0132c

Browse files
committed
Polishing
1 parent aa4ae7a commit fd0132c

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,22 @@ public class MockPart implements Part {
4949

5050
/**
5151
* Constructor for a part with byte[] content only.
52+
* @see #getHeaders()
5253
*/
53-
public MockPart(String name, byte[] content) {
54+
public MockPart(String name, @Nullable byte[] content) {
5455
this(name, null, content);
5556
}
5657

5758
/**
58-
* Constructor for a part with a filename.
59+
* Constructor for a part with a filename and streamed content.
60+
* @see #getHeaders()
5961
*/
6062
public MockPart(String name, @Nullable String filename, InputStream content) throws IOException {
6163
this(name, filename, FileCopyUtils.copyToByteArray(content));
6264
}
6365

6466
/**
65-
* Constructor for a part with byte[] content only.
67+
* Constructor for a part with a filename and byte[] content.
6668
* @see #getHeaders()
6769
*/
6870
private MockPart(String name, @Nullable String filename, @Nullable byte[] content) {

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
import java.io.IOException;
2121
import java.io.InputStream;
2222
import java.util.Collection;
23+
import java.util.Collections;
2324
import javax.servlet.http.Part;
2425

2526
import org.springframework.http.HttpHeaders;
2627
import org.springframework.http.MediaType;
2728
import org.springframework.util.Assert;
2829
import org.springframework.util.FileCopyUtils;
2930

30-
3131
/**
3232
* Mock implementation of {@code javax.servlet.http.Part}.
3333
*
@@ -47,20 +47,22 @@ public class MockPart implements Part {
4747

4848
/**
4949
* Constructor for a part with byte[] content only.
50+
* @see #getHeaders()
5051
*/
5152
public MockPart(String name, byte[] content) {
5253
this(name, null, content);
5354
}
5455

5556
/**
56-
* Constructor for a part with a filename.
57+
* Constructor for a part with a filename and streamed content.
58+
* @see #getHeaders()
5759
*/
5860
public MockPart(String name, String filename, InputStream content) throws IOException {
5961
this(name, filename, FileCopyUtils.copyToByteArray(content));
6062
}
6163

6264
/**
63-
* Constructor for a part with byte[] content only.
65+
* Constructor for a part with a filename and byte[] content.
6466
* @see #getHeaders()
6567
*/
6668
private MockPart(String name, String filename, byte[] content) {
@@ -105,7 +107,8 @@ public String getHeader(String name) {
105107

106108
@Override
107109
public Collection<String> getHeaders(String name) {
108-
return this.headers.get(name);
110+
Collection<String> headerValues = this.headers.get(name);
111+
return (headerValues != null ? headerValues : Collections.emptyList());
109112
}
110113

111114
@Override

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ public interface ClientResponse extends Closeable {
146146
@Override
147147
void close();
148148

149+
149150
/**
150151
* Represents the headers of the HTTP response.
151152
* @see ClientResponse#headers()
@@ -175,6 +176,6 @@ interface Headers {
175176
* Return the headers as a {@link HttpHeaders} instance.
176177
*/
177178
HttpHeaders asHttpHeaders();
178-
179179
}
180+
180181
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ protected final void sendMessageInternal(String message) throws SockJsTransportF
295295
synchronized (this.responseLock) {
296296
this.messageCache.add(message);
297297
if (logger.isTraceEnabled()) {
298-
logger.trace(this.messageCache.size() + " message(s) to flush in session " + this.getId());
298+
logger.trace(this.messageCache.size() + " message(s) to flush in session " + getId());
299299
}
300300
if (isActive() && this.readyToSend) {
301301
if (logger.isTraceEnabled()) {

0 commit comments

Comments
 (0)