Browse Source

Polishing

Closes gh-26878
pull/26905/head
Johnny Lim 4 years ago committed by GitHub
parent
commit
98770b15e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java
  2. 7
      spring-context/src/main/java/org/springframework/validation/annotation/ValidationAnnotationUtils.java
  3. 1
      spring-context/src/test/java/org/springframework/format/datetime/DateFormattingTests.java
  4. 1
      spring-test/src/test/java/org/springframework/mock/web/MockHttpServletResponseTests.java
  5. 2
      spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ExchangeFunction.java
  6. 2
      spring-webmvc/src/main/java/org/springframework/web/servlet/FrameworkServlet.java

2
spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java

@ -510,7 +510,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport @@ -510,7 +510,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
List<Object> allInterceptors = new ArrayList<>();
if (specificInterceptors != null) {
if (specificInterceptors.length > 0) {
// specificInterceptors may equals PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS
// specificInterceptors may equal PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS
allInterceptors.addAll(Arrays.asList(specificInterceptors));
}
if (commonInterceptors.length > 0) {

7
spring-context/src/main/java/org/springframework/validation/annotation/ValidationAnnotationUtils.java

@ -30,6 +30,8 @@ import org.springframework.lang.Nullable; @@ -30,6 +30,8 @@ import org.springframework.lang.Nullable;
*/
public abstract class ValidationAnnotationUtils {
private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
/**
* Determine any validation hints by the given annotation.
* <p>This implementation checks for {@code @javax.validation.Valid},
@ -38,14 +40,13 @@ public abstract class ValidationAnnotationUtils { @@ -38,14 +40,13 @@ public abstract class ValidationAnnotationUtils {
* @param ann the annotation (potentially a validation annotation)
* @return the validation hints to apply (possibly an empty array),
* or {@code null} if this annotation does not trigger any validation
* @since 5.3.7
*/
@Nullable
public static Object[] determineValidationHints(Annotation ann) {
Class<? extends Annotation> annotationType = ann.annotationType();
String annotationName = annotationType.getName();
if ("javax.validation.Valid".equals(annotationName)) {
return new Object[0];
return EMPTY_OBJECT_ARRAY;
}
Validated validatedAnn = AnnotationUtils.getAnnotation(ann, Validated.class);
if (validatedAnn != null) {
@ -61,7 +62,7 @@ public abstract class ValidationAnnotationUtils { @@ -61,7 +62,7 @@ public abstract class ValidationAnnotationUtils {
private static Object[] convertValidationHints(@Nullable Object hints) {
if (hints == null) {
return new Object[0];
return EMPTY_OBJECT_ARRAY;
}
return (hints instanceof Object[] ? (Object[]) hints : new Object[]{hints});
}

1
spring-context/src/test/java/org/springframework/format/datetime/DateFormattingTests.java

@ -130,7 +130,6 @@ public class DateFormattingTests { @@ -130,7 +130,6 @@ public class DateFormattingTests {
assertThat(bindingResult.getErrorCount()).isEqualTo(1);
FieldError fieldError = bindingResult.getFieldError(propertyName);
TypeMismatchException exception = fieldError.unwrap(TypeMismatchException.class);
exception.printStackTrace(System.err);
assertThat(exception)
.hasMessageContaining("for property 'styleDate'")
.hasCauseInstanceOf(ConversionFailedException.class).getCause()

1
spring-test/src/test/java/org/springframework/mock/web/MockHttpServletResponseTests.java

@ -496,7 +496,6 @@ class MockHttpServletResponseTests { @@ -496,7 +496,6 @@ class MockHttpServletResponseTests {
String expiryDate = "Tue, 8 Oct 2019 19:50:00 GMT";
String cookieValue = "SESSION=123; Path=/; Expires=" + expiryDate;
response.addHeader(SET_COOKIE, cookieValue);
System.err.println(response.getCookie("SESSION"));
assertThat(response.getHeader(SET_COOKIE)).isEqualTo(cookieValue);
assertNumCookies(1);

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

@ -44,7 +44,7 @@ public interface ExchangeFunction { @@ -44,7 +44,7 @@ public interface ExchangeFunction {
/**
* Exchange the given request for a {@link ClientResponse} promise.
*
* <p><strong>Note:</strong> When a calling this method from an
* <p><strong>Note:</strong> When calling this method from an
* {@link ExchangeFilterFunction} that handles the response in some way,
* extra care must be taken to always consume its content or otherwise
* propagate it downstream for further handling, for example by the

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

@ -1085,7 +1085,7 @@ public abstract class FrameworkServlet extends HttpServletBean implements Applic @@ -1085,7 +1085,7 @@ public abstract class FrameworkServlet extends HttpServletBean implements Applic
}
DispatcherType dispatchType = request.getDispatcherType();
boolean initialDispatch = DispatcherType.REQUEST.equals(request.getDispatcherType());
boolean initialDispatch = DispatcherType.REQUEST == dispatchType;
if (failureCause != null) {
if (!initialDispatch) {

Loading…
Cancel
Save