Skip to content

Polish #33566

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Polish #33566

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ To customize the default message, you can add properties to
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
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::
+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
/** Map from scope identifier String to corresponding Scope. */
private final Map<String, Scope> scopes = new LinkedHashMap<>(8);

/** Application startup metrics. **/
/** Application startup metrics. */
private ApplicationStartup applicationStartup = ApplicationStartup.DEFAULT;

/** Map from bean name to merged RootBeanDefinition. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
@Nullable
private ApplicationEventMulticaster applicationEventMulticaster;

/** Application startup metrics. **/
/** Application startup metrics. */
private ApplicationStartup applicationStartup = ApplicationStartup.DEFAULT;

/** Statically specified listeners. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private enum State {
* The write subscriber has subscribed, and cached signals have been
* emitted to it; we're ready to switch to a simple pass-through mode
* for all remaining signals.
**/
*/
READY_TO_WRITE

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class MockCookie extends Cookie {

private static final String SAME_SITE = "SameSite";
private static final String EXPIRES = "Expires";
private static final String PARTITIONED = "Partitioned";

@Nullable
private ZonedDateTime expires;
Expand Down Expand Up @@ -105,10 +106,10 @@ public String getSameSite() {
*/
public void setPartitioned(boolean partitioned) {
if (partitioned) {
setAttribute("Partitioned", "");
setAttribute(PARTITIONED, "");
}
else {
setAttribute("Partitioned", null);
setAttribute(PARTITIONED, null);
}
}

Expand All @@ -118,7 +119,7 @@ public void setPartitioned(boolean partitioned) {
* @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() {
return getAttribute("Partitioned") != null;
return getAttribute(PARTITIONED) != null;
}

/**
Expand Down Expand Up @@ -207,7 +208,7 @@ public String toString() {
.append("Comment", getComment())
.append("Secure", getSecure())
.append("HttpOnly", isHttpOnly())
.append("Partitioned", isPartitioned())
.append(PARTITIONED, isPartitioned())
.append(SAME_SITE, getSameSite())
.append("Max-Age", getMaxAge())
.append(EXPIRES, getAttribute(EXPIRES))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class JdkClientHttpConnector implements ClientHttpConnector {
private DataBufferFactory bufferFactory = DefaultDataBufferFactory.sharedInstance;

@Nullable
private Duration readTimeout = null;
private Duration readTimeout;


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class JdkClientHttpRequest extends AbstractClientHttpRequest {
private final HttpRequest.Builder builder;


public JdkClientHttpRequest(HttpMethod httpMethod, URI uri, DataBufferFactory bufferFactory,
JdkClientHttpRequest(HttpMethod httpMethod, URI uri, DataBufferFactory bufferFactory,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I fully understand the desire to remove public here, historically the code base often makes constructors public even if the enclosing type is not public.

Look at the other JdkClientHttpRequest implementation as well as neighboring classes for examples.

In light of that, I removed this change when merging the PR.

@Nullable Duration readTimeout) {
Assert.notNull(httpMethod, "HttpMethod is required");
Assert.notNull(uri, "URI is required");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private enum State {
* The write subscriber has subscribed, and cached signals have been
* emitted to it; we're ready to switch to a simple pass-through mode
* for all remaining signals.
**/
*/
READY_TO_WRITE

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ public void setValue() {

/**
* 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
* 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
* the initial REQUEST dispatch has exited.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ protected void decodeToMono() {
}

@Test
protected void decodeToFluxWithListElements() {
void decodeToFluxWithListElements() {
Flux<DataBuffer> input = Flux.concat(
stringBuffer("[{\"bar\":\"b1\",\"foo\":\"f1\"},{\"bar\":\"b2\",\"foo\":\"f2\"}]"),
stringBuffer("[{\"bar\":\"b3\",\"foo\":\"f3\"},{\"bar\":\"b4\",\"foo\":\"f4\"}]"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@
package org.springframework.web.util;

import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.nio.charset.StandardCharsets;

import org.junit.jupiter.api.Test;

import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.util.FastByteArrayOutputStream;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.testfixture.servlet.MockHttpServletRequest;

import static org.assertj.core.api.Assertions.assertThat;
Expand Down Expand Up @@ -95,13 +92,7 @@ void cachedContentToStringWithLimit() throws Exception {
@Test
void shouldNotAllocateMoreThanCacheLimit() throws Exception {
ContentCachingRequestWrapper wrapper = new ContentCachingRequestWrapper(createGetRequest("Hello World"), CONTENT_CACHE_LIMIT);
Field field = ReflectionUtils.findField(ContentCachingRequestWrapper.class, "cachedContent");
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);
assertThat(wrapper).extracting("cachedContent.initialBlockSize").isEqualTo(CONTENT_CACHE_LIMIT);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class MockCookie extends Cookie {

private static final String SAME_SITE = "SameSite";
private static final String EXPIRES = "Expires";
private static final String PARTITIONED = "Partitioned";

@Nullable
private ZonedDateTime expires;
Expand Down Expand Up @@ -105,10 +106,10 @@ public String getSameSite() {
*/
public void setPartitioned(boolean partitioned) {
if (partitioned) {
setAttribute("Partitioned", "");
setAttribute(PARTITIONED, "");
}
else {
setAttribute("Partitioned", null);
setAttribute(PARTITIONED, null);
}
}

Expand All @@ -118,7 +119,7 @@ public void setPartitioned(boolean partitioned) {
* @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() {
return getAttribute("Partitioned") != null;
return getAttribute(PARTITIONED) != null;
}

/**
Expand Down Expand Up @@ -202,7 +203,7 @@ public String toString() {
.append("Comment", getComment())
.append("Secure", getSecure())
.append("HttpOnly", isHttpOnly())
.append("Partitioned", isPartitioned())
.append(PARTITIONED, isPartitioned())
.append(SAME_SITE, getSameSite())
.append("Max-Age", getMaxAge())
.append(EXPIRES, getAttribute(EXPIRES))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

/**
* 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
* @since 13.12.2003
Expand Down