diff --git a/spring-web/src/main/java/org/springframework/http/ContentDisposition.java b/spring-web/src/main/java/org/springframework/http/ContentDisposition.java
index be48af5a9218..3e74f9ac1a1d 100644
--- a/spring-web/src/main/java/org/springframework/http/ContentDisposition.java
+++ b/spring-web/src/main/java/org/springframework/http/ContentDisposition.java
@@ -34,7 +34,7 @@
import static java.time.format.DateTimeFormatter.RFC_1123_DATE_TIME;
/**
- * Represent the Content-Disposition type and parameters as defined in RFC 6266.
+ * Representation of the Content-Disposition type and parameters as defined in RFC 6266.
*
* @author Sebastien Deleuze
* @author Juergen Hoeller
@@ -520,7 +520,7 @@ public interface Builder {
/**
* Set the value of the {@literal size} parameter.
* @deprecated since 5.2.3 as per
- * RFC 6266, Apendix B,
+ * RFC 6266, Appendix B,
* to be removed in a future release.
*/
@Deprecated
@@ -529,7 +529,7 @@ public interface Builder {
/**
* Set the value of the {@literal creation-date} parameter.
* @deprecated since 5.2.3 as per
- * RFC 6266, Apendix B,
+ * RFC 6266, Appendix B,
* to be removed in a future release.
*/
@Deprecated
@@ -538,7 +538,7 @@ public interface Builder {
/**
* Set the value of the {@literal modification-date} parameter.
* @deprecated since 5.2.3 as per
- * RFC 6266, Apendix B,
+ * RFC 6266, Appendix B,
* to be removed in a future release.
*/
@Deprecated
@@ -547,7 +547,7 @@ public interface Builder {
/**
* Set the value of the {@literal read-date} parameter.
* @deprecated since 5.2.3 as per
- * RFC 6266, Apendix B,
+ * RFC 6266, Appendix B,
* to be removed in a future release.
*/
@Deprecated
@@ -612,24 +612,28 @@ public Builder filename(String filename, Charset charset) {
}
@Override
+ @SuppressWarnings("deprecation")
public Builder size(Long size) {
this.size = size;
return this;
}
@Override
+ @SuppressWarnings("deprecation")
public Builder creationDate(ZonedDateTime creationDate) {
this.creationDate = creationDate;
return this;
}
@Override
+ @SuppressWarnings("deprecation")
public Builder modificationDate(ZonedDateTime modificationDate) {
this.modificationDate = modificationDate;
return this;
}
@Override
+ @SuppressWarnings("deprecation")
public Builder readDate(ZonedDateTime readDate) {
this.readDate = readDate;
return this;
diff --git a/spring-web/src/main/java/org/springframework/http/codec/support/BaseCodecConfigurer.java b/spring-web/src/main/java/org/springframework/http/codec/support/BaseCodecConfigurer.java
index 266f6bbe3cfe..017a96a3564a 100644
--- a/spring-web/src/main/java/org/springframework/http/codec/support/BaseCodecConfigurer.java
+++ b/spring-web/src/main/java/org/springframework/http/codec/support/BaseCodecConfigurer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2019 the original author or authors.
+ * Copyright 2002-2020 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.
@@ -142,10 +142,10 @@ protected static final class DefaultCustomCodecs implements CustomCodecs {
* @since 5.1.12
*/
DefaultCustomCodecs(DefaultCustomCodecs other) {
- other.typedReaders.putAll(this.typedReaders);
- other.typedWriters.putAll(this.typedWriters);
- other.objectReaders.putAll(this.objectReaders);
- other.objectWriters.putAll(this.objectWriters);
+ this.typedReaders.putAll(other.typedReaders);
+ this.typedWriters.putAll(other.typedWriters);
+ this.objectReaders.putAll(other.objectReaders);
+ this.objectWriters.putAll(other.objectWriters);
}
@Override
diff --git a/spring-web/src/test/java/org/springframework/http/codec/support/CodecConfigurerTests.java b/spring-web/src/test/java/org/springframework/http/codec/support/CodecConfigurerTests.java
index e26cc7a4357a..92e13257a9e1 100644
--- a/spring-web/src/test/java/org/springframework/http/codec/support/CodecConfigurerTests.java
+++ b/spring-web/src/test/java/org/springframework/http/codec/support/CodecConfigurerTests.java
@@ -69,7 +69,7 @@
* @author Rossen Stoyanchev
* @author Sebastien Deleuze
*/
-public class CodecConfigurerTests {
+class CodecConfigurerTests {
private final CodecConfigurer configurer = new TestCodecConfigurer();
@@ -77,7 +77,7 @@ public class CodecConfigurerTests {
@Test
- public void defaultReaders() {
+ void defaultReaders() {
List> readers = this.configurer.getReaders();
assertThat(readers.size()).isEqualTo(12);
assertThat(getNextDecoder(readers).getClass()).isEqualTo(ByteArrayDecoder.class);
@@ -95,7 +95,7 @@ public void defaultReaders() {
}
@Test
- public void defaultWriters() {
+ void defaultWriters() {
List> writers = this.configurer.getWriters();
assertThat(writers.size()).isEqualTo(11);
assertThat(getNextEncoder(writers).getClass()).isEqualTo(ByteArrayEncoder.class);
@@ -112,7 +112,7 @@ public void defaultWriters() {
}
@Test
- public void defaultAndCustomReaders() {
+ void defaultAndCustomReaders() {
Decoder> customDecoder1 = mock(Decoder.class);
Decoder> customDecoder2 = mock(Decoder.class);
@@ -153,7 +153,7 @@ public void defaultAndCustomReaders() {
}
@Test
- public void defaultAndCustomWriters() {
+ void defaultAndCustomWriters() {
Encoder> customEncoder1 = mock(Encoder.class);
Encoder> customEncoder2 = mock(Encoder.class);
@@ -193,7 +193,7 @@ public void defaultAndCustomWriters() {
}
@Test
- public void defaultsOffCustomReaders() {
+ void defaultsOffCustomReaders() {
Decoder> customDecoder1 = mock(Decoder.class);
Decoder> customDecoder2 = mock(Decoder.class);
@@ -224,7 +224,7 @@ public void defaultsOffCustomReaders() {
}
@Test
- public void defaultsOffWithCustomWriters() {
+ void defaultsOffWithCustomWriters() {
Encoder> customEncoder1 = mock(Encoder.class);
Encoder> customEncoder2 = mock(Encoder.class);
@@ -255,7 +255,7 @@ public void defaultsOffWithCustomWriters() {
}
@Test
- public void encoderDecoderOverrides() {
+ void encoderDecoderOverrides() {
Jackson2JsonDecoder jacksonDecoder = new Jackson2JsonDecoder();
Jackson2JsonEncoder jacksonEncoder = new Jackson2JsonEncoder();
Jackson2SmileDecoder smileDecoder = new Jackson2SmileDecoder();
@@ -285,23 +285,45 @@ public void encoderDecoderOverrides() {
}
@Test
- public void cloneCustomCodecs() {
+ void cloneEmptyCustomCodecs() {
this.configurer.registerDefaults(false);
- CodecConfigurer clone = this.configurer.clone();
+ assertThat(this.configurer.getReaders()).isEmpty();
+ assertThat(this.configurer.getWriters()).isEmpty();
+ CodecConfigurer clone = this.configurer.clone();
clone.customCodecs().register(new Jackson2JsonEncoder());
clone.customCodecs().register(new Jackson2JsonDecoder());
clone.customCodecs().register(new ServerSentEventHttpMessageReader());
clone.customCodecs().register(new ServerSentEventHttpMessageWriter());
- assertThat(this.configurer.getReaders().size()).isEqualTo(0);
- assertThat(this.configurer.getWriters().size()).isEqualTo(0);
- assertThat(clone.getReaders().size()).isEqualTo(2);
- assertThat(clone.getWriters().size()).isEqualTo(2);
+ assertThat(this.configurer.getReaders()).isEmpty();
+ assertThat(this.configurer.getWriters()).isEmpty();
+ assertThat(clone.getReaders()).hasSize(2);
+ assertThat(clone.getWriters()).hasSize(2);
+ }
+
+ @Test
+ void cloneCustomCodecs() {
+ this.configurer.registerDefaults(false);
+ assertThat(this.configurer.getReaders()).isEmpty();
+ assertThat(this.configurer.getWriters()).isEmpty();
+
+ this.configurer.customCodecs().register(new Jackson2JsonEncoder());
+ this.configurer.customCodecs().register(new Jackson2JsonDecoder());
+ this.configurer.customCodecs().register(new ServerSentEventHttpMessageReader());
+ this.configurer.customCodecs().register(new ServerSentEventHttpMessageWriter());
+ assertThat(this.configurer.getReaders()).hasSize(2);
+ assertThat(this.configurer.getWriters()).hasSize(2);
+
+ CodecConfigurer clone = this.configurer.clone();
+ assertThat(this.configurer.getReaders()).hasSize(2);
+ assertThat(this.configurer.getWriters()).hasSize(2);
+ assertThat(clone.getReaders()).hasSize(2);
+ assertThat(clone.getWriters()).hasSize(2);
}
@Test
- public void cloneDefaultCodecs() {
+ void cloneDefaultCodecs() {
CodecConfigurer clone = this.configurer.clone();
Jackson2JsonDecoder jacksonDecoder = new Jackson2JsonDecoder();