Polishing

Closes gh-26878
This commit is contained in:
Johnny Lim 2021-04-29 23:53:53 +09:00 committed by GitHub
parent 697108cc42
commit 98770b15e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 8 deletions

View File

@ -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) {

View File

@ -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 {
* @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 {
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});
}

View File

@ -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()

View File

@ -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);

View File

@ -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

View File

@ -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) {