Browse Source

Polish

Closes gh-33566
pull/33578/head
Johnny Lim 1 year ago committed by Sam Brannen
parent
commit
3ba9d35e22
  1. 2
      framework-docs/modules/ROOT/pages/core/validation/beanvalidation.adoc
  2. 2
      spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java
  3. 2
      spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java
  4. 2
      spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/ChannelSendOperator.java
  5. 9
      spring-test/src/main/java/org/springframework/mock/web/MockCookie.java
  6. 2
      spring-web/src/main/java/org/springframework/http/client/reactive/JdkClientHttpConnector.java
  7. 2
      spring-web/src/main/java/org/springframework/http/server/reactive/ChannelSendOperator.java
  8. 4
      spring-web/src/main/java/org/springframework/web/context/request/RequestAttributesThreadLocalAccessor.java
  9. 2
      spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonDecoderTests.java
  10. 11
      spring-web/src/test/java/org/springframework/web/util/ContentCachingRequestWrapperTests.java
  11. 9
      spring-web/src/testFixtures/java/org/springframework/web/testfixture/servlet/MockCookie.java
  12. 2
      spring-webmvc/src/main/java/org/springframework/web/servlet/view/AbstractUrlBasedView.java

2
framework-docs/modules/ROOT/pages/core/validation/beanvalidation.adoc

@ -385,7 +385,7 @@ To customize the default message, you can add properties to
xref:core/beans/context-introduction.adoc#context-functionality-messagesource[MessageSource] xref:core/beans/context-introduction.adoc#context-functionality-messagesource[MessageSource]
resource bundles using any of the above errors codes and message arguments. Note also that the resource bundles using any of the above errors codes and message arguments. Note also that the
message argument `"name"` is itself a `MessageSourceResolvable` with error codes message argument `"name"` is itself a `MessageSourceResolvable` with error codes
`"person.name"` and `"name"` and can customized too. For example: `"person.name"` and `"name"` and can be customized too. For example:
Properties:: Properties::
+ +

2
spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java

@ -160,7 +160,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
/** Map from scope identifier String to corresponding Scope. */ /** Map from scope identifier String to corresponding Scope. */
private final Map<String, Scope> scopes = new LinkedHashMap<>(8); private final Map<String, Scope> scopes = new LinkedHashMap<>(8);
/** Application startup metrics. **/ /** Application startup metrics. */
private ApplicationStartup applicationStartup = ApplicationStartup.DEFAULT; private ApplicationStartup applicationStartup = ApplicationStartup.DEFAULT;
/** Map from bean name to merged RootBeanDefinition. */ /** Map from bean name to merged RootBeanDefinition. */

2
spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java

@ -234,7 +234,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
@Nullable @Nullable
private ApplicationEventMulticaster applicationEventMulticaster; private ApplicationEventMulticaster applicationEventMulticaster;
/** Application startup metrics. **/ /** Application startup metrics. */
private ApplicationStartup applicationStartup = ApplicationStartup.DEFAULT; private ApplicationStartup applicationStartup = ApplicationStartup.DEFAULT;
/** Statically specified listeners. */ /** Statically specified listeners. */

2
spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/ChannelSendOperator.java

@ -107,7 +107,7 @@ class ChannelSendOperator<T> extends Mono<Void> implements Scannable {
* The write subscriber has subscribed, and cached signals have been * The write subscriber has subscribed, and cached signals have been
* emitted to it; we're ready to switch to a simple pass-through mode * emitted to it; we're ready to switch to a simple pass-through mode
* for all remaining signals. * for all remaining signals.
**/ */
READY_TO_WRITE READY_TO_WRITE
} }

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

@ -45,6 +45,7 @@ public class MockCookie extends Cookie {
private static final String SAME_SITE = "SameSite"; private static final String SAME_SITE = "SameSite";
private static final String EXPIRES = "Expires"; private static final String EXPIRES = "Expires";
private static final String PARTITIONED = "Partitioned";
@Nullable @Nullable
private ZonedDateTime expires; private ZonedDateTime expires;
@ -105,10 +106,10 @@ public class MockCookie extends Cookie {
*/ */
public void setPartitioned(boolean partitioned) { public void setPartitioned(boolean partitioned) {
if (partitioned) { if (partitioned) {
setAttribute("Partitioned", ""); setAttribute(PARTITIONED, "");
} }
else { else {
setAttribute("Partitioned", null); setAttribute(PARTITIONED, null);
} }
} }
@ -118,7 +119,7 @@ public class MockCookie extends Cookie {
* @see <a href="https://datatracker.ietf.org/doc/html/draft-cutler-httpbis-partitioned-cookies#section-2.1">The Partitioned attribute spec</a> * @see <a href="https://datatracker.ietf.org/doc/html/draft-cutler-httpbis-partitioned-cookies#section-2.1">The Partitioned attribute spec</a>
*/ */
public boolean isPartitioned() { public boolean isPartitioned() {
return getAttribute("Partitioned") != null; return getAttribute(PARTITIONED) != null;
} }
/** /**
@ -207,7 +208,7 @@ public class MockCookie extends Cookie {
.append("Comment", getComment()) .append("Comment", getComment())
.append("Secure", getSecure()) .append("Secure", getSecure())
.append("HttpOnly", isHttpOnly()) .append("HttpOnly", isHttpOnly())
.append("Partitioned", isPartitioned()) .append(PARTITIONED, isPartitioned())
.append(SAME_SITE, getSameSite()) .append(SAME_SITE, getSameSite())
.append("Max-Age", getMaxAge()) .append("Max-Age", getMaxAge())
.append(EXPIRES, getAttribute(EXPIRES)) .append(EXPIRES, getAttribute(EXPIRES))

2
spring-web/src/main/java/org/springframework/http/client/reactive/JdkClientHttpConnector.java

@ -51,7 +51,7 @@ public class JdkClientHttpConnector implements ClientHttpConnector {
private DataBufferFactory bufferFactory = DefaultDataBufferFactory.sharedInstance; private DataBufferFactory bufferFactory = DefaultDataBufferFactory.sharedInstance;
@Nullable @Nullable
private Duration readTimeout = null; private Duration readTimeout;
/** /**

2
spring-web/src/main/java/org/springframework/http/server/reactive/ChannelSendOperator.java

@ -99,7 +99,7 @@ public class ChannelSendOperator<T> extends Mono<Void> implements Scannable {
* The write subscriber has subscribed, and cached signals have been * The write subscriber has subscribed, and cached signals have been
* emitted to it; we're ready to switch to a simple pass-through mode * emitted to it; we're ready to switch to a simple pass-through mode
* for all remaining signals. * for all remaining signals.
**/ */
READY_TO_WRITE READY_TO_WRITE
} }

4
spring-web/src/main/java/org/springframework/web/context/request/RequestAttributesThreadLocalAccessor.java

@ -70,10 +70,10 @@ public class RequestAttributesThreadLocalAccessor implements ThreadLocalAccessor
/** /**
* ServletRequestAttributes that takes another instance, and makes a copy of the * ServletRequestAttributes that takes another instance, and makes a copy of the
* request attributes at present to provides extended read access during async * request attributes at present to provide extended read access during async
* handling when the DispatcherServlet has exited from the initial REQUEST dispatch * handling when the DispatcherServlet has exited from the initial REQUEST dispatch
* and marked the request {@link ServletRequestAttributes#requestCompleted()}. * and marked the request {@link ServletRequestAttributes#requestCompleted()}.
* <p>Note that beyond access to request attributes, here is no attempt to support * <p>Note that beyond access to request attributes, there is no attempt to support
* setting or removing request attributes, nor to access session attributes after * setting or removing request attributes, nor to access session attributes after
* the initial REQUEST dispatch has exited. * the initial REQUEST dispatch has exited.
*/ */

2
spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonDecoderTests.java

@ -174,7 +174,7 @@ class Jackson2JsonDecoderTests extends AbstractDecoderTests<Jackson2JsonDecoder>
} }
@Test @Test
protected void decodeToFluxWithListElements() { void decodeToFluxWithListElements() {
Flux<DataBuffer> input = Flux.concat( Flux<DataBuffer> input = Flux.concat(
stringBuffer("[{\"bar\":\"b1\",\"foo\":\"f1\"},{\"bar\":\"b2\",\"foo\":\"f2\"}]"), stringBuffer("[{\"bar\":\"b1\",\"foo\":\"f1\"},{\"bar\":\"b2\",\"foo\":\"f2\"}]"),
stringBuffer("[{\"bar\":\"b3\",\"foo\":\"f3\"},{\"bar\":\"b4\",\"foo\":\"f4\"}]")); stringBuffer("[{\"bar\":\"b3\",\"foo\":\"f3\"},{\"bar\":\"b4\",\"foo\":\"f4\"}]"));

11
spring-web/src/test/java/org/springframework/web/util/ContentCachingRequestWrapperTests.java

@ -17,15 +17,12 @@
package org.springframework.web.util; package org.springframework.web.util;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.util.FastByteArrayOutputStream;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.testfixture.servlet.MockHttpServletRequest; import org.springframework.web.testfixture.servlet.MockHttpServletRequest;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
@ -95,13 +92,7 @@ class ContentCachingRequestWrapperTests {
@Test @Test
void shouldNotAllocateMoreThanCacheLimit() throws Exception { void shouldNotAllocateMoreThanCacheLimit() throws Exception {
ContentCachingRequestWrapper wrapper = new ContentCachingRequestWrapper(createGetRequest("Hello World"), CONTENT_CACHE_LIMIT); ContentCachingRequestWrapper wrapper = new ContentCachingRequestWrapper(createGetRequest("Hello World"), CONTENT_CACHE_LIMIT);
Field field = ReflectionUtils.findField(ContentCachingRequestWrapper.class, "cachedContent"); assertThat(wrapper).extracting("cachedContent.initialBlockSize").isEqualTo(CONTENT_CACHE_LIMIT);
ReflectionUtils.makeAccessible(field);
FastByteArrayOutputStream cachedContent = (FastByteArrayOutputStream) ReflectionUtils.getField(field, wrapper);
field = ReflectionUtils.findField(FastByteArrayOutputStream.class, "initialBlockSize");
ReflectionUtils.makeAccessible(field);
int blockSize = (int) ReflectionUtils.getField(field, cachedContent);
assertThat(blockSize).isEqualTo(CONTENT_CACHE_LIMIT);
} }

9
spring-web/src/testFixtures/java/org/springframework/web/testfixture/servlet/MockCookie.java

@ -45,6 +45,7 @@ public class MockCookie extends Cookie {
private static final String SAME_SITE = "SameSite"; private static final String SAME_SITE = "SameSite";
private static final String EXPIRES = "Expires"; private static final String EXPIRES = "Expires";
private static final String PARTITIONED = "Partitioned";
@Nullable @Nullable
private ZonedDateTime expires; private ZonedDateTime expires;
@ -105,10 +106,10 @@ public class MockCookie extends Cookie {
*/ */
public void setPartitioned(boolean partitioned) { public void setPartitioned(boolean partitioned) {
if (partitioned) { if (partitioned) {
setAttribute("Partitioned", ""); setAttribute(PARTITIONED, "");
} }
else { else {
setAttribute("Partitioned", null); setAttribute(PARTITIONED, null);
} }
} }
@ -118,7 +119,7 @@ public class MockCookie extends Cookie {
* @see <a href="https://datatracker.ietf.org/doc/html/draft-cutler-httpbis-partitioned-cookies#section-2.1">The Partitioned attribute spec</a> * @see <a href="https://datatracker.ietf.org/doc/html/draft-cutler-httpbis-partitioned-cookies#section-2.1">The Partitioned attribute spec</a>
*/ */
public boolean isPartitioned() { public boolean isPartitioned() {
return getAttribute("Partitioned") != null; return getAttribute(PARTITIONED) != null;
} }
/** /**
@ -202,7 +203,7 @@ public class MockCookie extends Cookie {
.append("Comment", getComment()) .append("Comment", getComment())
.append("Secure", getSecure()) .append("Secure", getSecure())
.append("HttpOnly", isHttpOnly()) .append("HttpOnly", isHttpOnly())
.append("Partitioned", isPartitioned()) .append(PARTITIONED, isPartitioned())
.append(SAME_SITE, getSameSite()) .append(SAME_SITE, getSameSite())
.append("Max-Age", getMaxAge()) .append("Max-Age", getMaxAge())
.append(EXPIRES, getAttribute(EXPIRES)) .append(EXPIRES, getAttribute(EXPIRES))

2
spring-webmvc/src/main/java/org/springframework/web/servlet/view/AbstractUrlBasedView.java

@ -23,7 +23,7 @@ import org.springframework.lang.Nullable;
/** /**
* Abstract base class for URL-based views. Provides a consistent way of * Abstract base class for URL-based views. Provides a consistent way of
* holding the URL that a View wraps, in the form of an "url" bean property. * holding the URL that a View wraps, in the form of a "url" bean property.
* *
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 13.12.2003 * @since 13.12.2003

Loading…
Cancel
Save