Introduce Checkstyle rule for separator symbol location
This commit is contained in:
@@ -416,14 +416,13 @@ final class MultipartParser extends BaseSubscriber<DataBuffer> {
|
||||
*/
|
||||
private boolean isLastBoundary(DataBuffer buf) {
|
||||
return (this.buffers.isEmpty() &&
|
||||
buf.readableByteCount() >= 2 &&
|
||||
buf.getByte(0) == HYPHEN && buf.getByte(1) == HYPHEN)
|
||||
||
|
||||
buf.readableByteCount() >= 2 &&
|
||||
buf.getByte(0) == HYPHEN && buf.getByte(1) == HYPHEN) ||
|
||||
(this.buffers.size() == 1 &&
|
||||
this.buffers.get(0).readableByteCount() == 1 &&
|
||||
this.buffers.get(0).getByte(0) == HYPHEN &&
|
||||
buf.readableByteCount() >= 1 &&
|
||||
buf.getByte(0) == HYPHEN);
|
||||
this.buffers.get(0).readableByteCount() == 1 &&
|
||||
this.buffers.get(0).getByte(0) == HYPHEN &&
|
||||
buf.readableByteCount() >= 1 &&
|
||||
buf.getByte(0) == HYPHEN);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -104,7 +104,7 @@ abstract class MultipartUtils {
|
||||
|
||||
public static boolean isFormField(HttpHeaders headers) {
|
||||
MediaType contentType = headers.getContentType();
|
||||
return (contentType == null || MediaType.TEXT_PLAIN.equalsTypeAndSubtype(contentType))
|
||||
&& headers.getContentDisposition().getFilename() == null;
|
||||
return (contentType == null || MediaType.TEXT_PLAIN.equalsTypeAndSubtype(contentType)) &&
|
||||
headers.getContentDisposition().getFilename() == null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,8 +212,8 @@ public class PartEventHttpMessageReader extends LoggingCodecSupport implements H
|
||||
this.maxPartSize + " bytes"));
|
||||
}
|
||||
else {
|
||||
return isFilePart ? Mono.just(DefaultPartEvents.file(headers, buffer, body.isLast()))
|
||||
: Mono.just(DefaultPartEvents.create(headers, body.buffer(), body.isLast()));
|
||||
return (isFilePart ? Mono.just(DefaultPartEvents.file(headers, buffer, body.isLast())) :
|
||||
Mono.just(DefaultPartEvents.create(headers, body.buffer(), body.isLast())));
|
||||
}
|
||||
})
|
||||
.switchIfEmpty(Mono.fromCallable(() ->
|
||||
|
||||
@@ -163,9 +163,8 @@ final class PartGenerator extends BaseSubscriber<MultipartParser.Token> {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
logger.warn("Could not switch from " + oldState +
|
||||
" to " + newState + "; current state:"
|
||||
+ this.state.get());
|
||||
logger.warn("Could not switch from " + oldState + " to " + newState +
|
||||
"; current state:" + this.state.get());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -752,8 +752,8 @@ public class CorsConfiguration {
|
||||
}
|
||||
|
||||
boolean allowAnyHeader = this.allowedHeaders.contains(ALL);
|
||||
int maxResultSize = allowAnyHeader ? requestHeaders.size()
|
||||
: Math.min(requestHeaders.size(), this.allowedHeaders.size());
|
||||
int maxResultSize = (allowAnyHeader ? requestHeaders.size() :
|
||||
Math.min(requestHeaders.size(), this.allowedHeaders.size()));
|
||||
List<String> result = new ArrayList<>(maxResultSize);
|
||||
for (String requestHeader : requestHeaders) {
|
||||
if (StringUtils.hasText(requestHeader)) {
|
||||
|
||||
@@ -50,9 +50,8 @@ public abstract class CorsUtils {
|
||||
*/
|
||||
public static boolean isPreFlightRequest(ServerHttpRequest request) {
|
||||
HttpHeaders headers = request.getHeaders();
|
||||
return (request.getMethod() == HttpMethod.OPTIONS
|
||||
&& headers.containsKey(HttpHeaders.ORIGIN)
|
||||
&& headers.containsKey(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD));
|
||||
return (request.getMethod() == HttpMethod.OPTIONS && headers.containsKey(HttpHeaders.ORIGIN) &&
|
||||
headers.containsKey(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -321,9 +321,9 @@ public class InvocableHandlerMethod extends HandlerMethod {
|
||||
Object arg = args[index];
|
||||
if (!(parameter.isOptional() && arg == null)) {
|
||||
KType type = parameter.getType();
|
||||
if (!(type.isMarkedNullable() && arg == null)
|
||||
&& type.getClassifier() instanceof KClass<?> kClass
|
||||
&& KotlinDetector.isInlineClass(JvmClassMappingKt.getJavaClass(kClass))) {
|
||||
if (!(type.isMarkedNullable() && arg == null) &&
|
||||
type.getClassifier() instanceof KClass<?> kClass &&
|
||||
KotlinDetector.isInlineClass(JvmClassMappingKt.getJavaClass(kClass))) {
|
||||
arg = box(kClass, arg);
|
||||
}
|
||||
argMap.put(parameter, arg);
|
||||
@@ -342,9 +342,9 @@ public class InvocableHandlerMethod extends HandlerMethod {
|
||||
private static Object box(KClass<?> kClass, @Nullable Object arg) {
|
||||
KFunction<?> constructor = Objects.requireNonNull(KClasses.getPrimaryConstructor(kClass));
|
||||
KType type = constructor.getParameters().get(0).getType();
|
||||
if (!(type.isMarkedNullable() && arg == null)
|
||||
&& type.getClassifier() instanceof KClass<?> parameterClass
|
||||
&& KotlinDetector.isInlineClass(JvmClassMappingKt.getJavaClass(parameterClass))) {
|
||||
if (!(type.isMarkedNullable() && arg == null) &&
|
||||
type.getClassifier() instanceof KClass<?> parameterClass &&
|
||||
KotlinDetector.isInlineClass(JvmClassMappingKt.getJavaClass(parameterClass))) {
|
||||
arg = box(parameterClass, arg);
|
||||
}
|
||||
if (!KCallablesJvm.isAccessible(constructor)) {
|
||||
|
||||
@@ -88,8 +88,8 @@ class ErrorHandlerIntegrationTests extends AbstractHttpHandlerIntegrationTests {
|
||||
// but an application can apply CompactPathRule via RewriteHandler:
|
||||
// https://www.eclipse.org/jetty/documentation/jetty-11/programming_guide.php
|
||||
|
||||
HttpStatus expectedStatus = (httpServer instanceof JettyHttpServer || httpServer instanceof JettyCoreHttpServer
|
||||
? HttpStatus.BAD_REQUEST : HttpStatus.OK);
|
||||
HttpStatus expectedStatus = (httpServer instanceof JettyHttpServer || httpServer instanceof JettyCoreHttpServer ?
|
||||
HttpStatus.BAD_REQUEST : HttpStatus.OK);
|
||||
|
||||
assertThat(response.getStatusCode()).isEqualTo(expectedStatus);
|
||||
}
|
||||
|
||||
@@ -55,8 +55,8 @@ class ZeroCopyIntegrationTests extends AbstractHttpHandlerIntegrationTests {
|
||||
|
||||
@ParameterizedHttpServerTest
|
||||
void zeroCopy(HttpServer httpServer) throws Exception {
|
||||
assumeTrue(httpServer instanceof ReactorHttpServer || httpServer instanceof UndertowHttpServer
|
||||
|| httpServer instanceof JettyCoreHttpServer, "Zero-copy does not support Servlet");
|
||||
assumeTrue(httpServer instanceof ReactorHttpServer || httpServer instanceof UndertowHttpServer ||
|
||||
httpServer instanceof JettyCoreHttpServer, "Zero-copy does not support Servlet");
|
||||
|
||||
startServer(httpServer);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
* Copyright 2002-2025 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.
|
||||
@@ -258,23 +258,25 @@ class RequestLoggingFilterTests {
|
||||
filter.doFilter(request, response, filterChain);
|
||||
|
||||
assertThat(filter.beforeRequestMessage)
|
||||
.isEqualTo("Before request ["
|
||||
+ "POST /hotels?booking=42"
|
||||
+ ", client=4.2.2.2"
|
||||
+ ", session=42"
|
||||
+ ", user=Arthur"
|
||||
+ ", headers=[Content-Type:\"application/json;charset=ISO-8859-1\", Content-Length:\"22\"]"
|
||||
+ "]");
|
||||
.isEqualTo("""
|
||||
Before request [\
|
||||
POST /hotels?booking=42, \
|
||||
client=4.2.2.2, \
|
||||
session=42, \
|
||||
user=Arthur, \
|
||||
headers=[Content-Type:"application/json;charset=ISO-8859-1", Content-Length:"22"]\
|
||||
]""");
|
||||
|
||||
assertThat(filter.afterRequestMessage)
|
||||
.isEqualTo("After request ["
|
||||
+ "POST /hotels?booking=42"
|
||||
+ ", client=4.2.2.2"
|
||||
+ ", session=42"
|
||||
+ ", user=Arthur"
|
||||
+ ", headers=[Content-Type:\"application/json;charset=ISO-8859-1\", Content-Length:\"22\"]"
|
||||
+ ", payload={\"msg\": \"Hello World\"}"
|
||||
+ "]");
|
||||
.isEqualTo("""
|
||||
After request [\
|
||||
POST /hotels?booking=42, \
|
||||
client=4.2.2.2, \
|
||||
session=42, \
|
||||
user=Arthur, \
|
||||
headers=[Content-Type:"application/json;charset=ISO-8859-1", Content-Length:"22"], \
|
||||
payload={"msg": "Hello World"}\
|
||||
]""");
|
||||
}
|
||||
|
||||
private void applyFilter() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user