Skip to content

Commit 7917ae5

Browse files
committed
Polishing
1 parent 693ec82 commit 7917ae5

File tree

5 files changed

+13
-27
lines changed

5 files changed

+13
-27
lines changed

spring-web/src/main/java/org/springframework/http/codec/multipart/DefaultPartHttpMessageReader.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ public class DefaultPartHttpMessageReader extends LoggingCodecSupport implements
7575

7676
/**
7777
* Configure the maximum amount of memory that is allowed per headers section of each part.
78-
* When the limit
7978
* @param byteCount the maximum amount of memory for headers
8079
*/
8180
public void setMaxHeadersSize(int byteCount) {
@@ -93,8 +92,8 @@ public int getMaxInMemorySize() {
9392
* Configure the maximum amount of memory allowed per part.
9493
* When the limit is exceeded:
9594
* <ul>
96-
* <li>file parts are written to a temporary file.
97-
* <li>non-file parts are rejected with {@link DataBufferLimitException}.
95+
* <li>File parts are written to a temporary file.
96+
* <li>Non-file parts are rejected with {@link DataBufferLimitException}.
9897
* </ul>
9998
* <p>By default this is set to 256K.
10099
* @param maxInMemorySize the in-memory limit in bytes; if set to -1 the entire
@@ -158,7 +157,7 @@ private Scheduler getBlockingOperationScheduler() {
158157

159158
/**
160159
* Set the character set used to decode headers.
161-
* Defaults to UTF-8 as per RFC 7578.
160+
* <p>Defaults to UTF-8 as per RFC 7578.
162161
* @param headersCharset the charset to use for decoding headers
163162
* @since 5.3.6
164163
* @see <a href="https://tools.ietf.org/html/rfc7578#section-5.1">RFC-7578 Section 5.1</a>
@@ -218,5 +217,4 @@ private boolean tooManyParts(AtomicInteger partCount) {
218217
return this.maxParts > 0 && count > this.maxParts;
219218
}
220219

221-
222220
}

spring-web/src/main/java/org/springframework/http/codec/multipart/PartGenerator.java

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252

5353
/**
5454
* Subscribes to a token stream (i.e. the result of
55-
* {@link MultipartParser#parse(Flux, byte[], int, Charset)}), and produces a flux of {@link Part} objects.
55+
* {@link MultipartParser#parse(Flux, byte[], int, Charset)}), and produces a flux
56+
* of {@link Part} objects.
5657
*
5758
* @author Arjen Poutsma
5859
* @since 5.3
@@ -330,7 +331,6 @@ public void onComplete() {
330331
public String toString() {
331332
return "FORM-FIELD";
332333
}
333-
334334
}
335335

336336

@@ -422,7 +422,6 @@ public void dispose() {
422422
public String toString() {
423423
return "IN-MEMORY";
424424
}
425-
426425
}
427426

428427

@@ -487,7 +486,6 @@ private void fileCreated(WritingFileState newState) {
487486
this.releaseOnDispose = false;
488487

489488
if (changeState(this, newState)) {
490-
491489
newState.writeBuffers(this.content);
492490

493491
if (this.completed) {
@@ -512,10 +510,9 @@ public void dispose() {
512510
public String toString() {
513511
return "CREATE-FILE";
514512
}
515-
516-
517513
}
518514

515+
519516
private final class IdleFileState implements State {
520517

521518
private final HttpHeaders headers;
@@ -542,7 +539,6 @@ public IdleFileState(WritingFileState state) {
542539
public void body(DataBuffer dataBuffer) {
543540
long count = this.byteCount.addAndGet(dataBuffer.readableByteCount());
544541
if (PartGenerator.this.maxDiskUsagePerPart == -1 || count <= PartGenerator.this.maxDiskUsagePerPart) {
545-
546542
this.closeOnDispose = false;
547543
this.deleteOnDispose = false;
548544
WritingFileState newState = new WritingFileState(this);
@@ -582,16 +578,14 @@ public void dispose() {
582578
}
583579
}
584580

585-
586581
@Override
587582
public String toString() {
588583
return "IDLE-FILE";
589584
}
590-
591585
}
592586

593-
private final class WritingFileState implements State {
594587

588+
private final class WritingFileState implements State {
595589

596590
private final HttpHeaders headers;
597591

@@ -643,19 +637,15 @@ public void writeBuffer(DataBuffer dataBuffer) {
643637
Mono.just(dataBuffer)
644638
.flatMap(this::writeInternal)
645639
.subscribeOn(PartGenerator.this.blockingOperationScheduler)
646-
.subscribe(null,
647-
PartGenerator.this::emitError,
648-
this::writeComplete);
640+
.subscribe(null, PartGenerator.this::emitError, this::writeComplete);
649641
}
650642

651643
public void writeBuffers(Iterable<DataBuffer> dataBuffers) {
652644
Flux.fromIterable(dataBuffers)
653645
.concatMap(this::writeInternal)
654646
.then()
655647
.subscribeOn(PartGenerator.this.blockingOperationScheduler)
656-
.subscribe(null,
657-
PartGenerator.this::emitError,
658-
this::writeComplete);
648+
.subscribe(null, PartGenerator.this::emitError, this::writeComplete);
659649
}
660650

661651
private void writeComplete() {
@@ -710,7 +700,6 @@ public void dispose() {
710700
this.disposed = true;
711701
}
712702

713-
714703
@Override
715704
public String toString() {
716705
return "WRITE-FILE";
@@ -738,7 +727,6 @@ public void onComplete() {
738727
public String toString() {
739728
return "DISPOSED";
740729
}
741-
742730
}
743731

744732
}

spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ void retrieveJsonArrayAsResponseEntityFluxWithBodyExtractor(ClientHttpConnector
441441
}
442442

443443
@Test // gh-24788
444-
void retrieveJsonArrayAsBodilessEntityShouldReleasesConnection() throws IOException {
444+
void retrieveJsonArrayAsBodilessEntityShouldReleaseConnection() throws IOException {
445445

446446
// Constrain connection pool and make consecutive requests.
447447
// 2nd request should hang if response was not drained.

spring-webflux/src/test/java/org/springframework/web/reactive/handler/SimpleUrlHandlerMappingTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void handlerMappingXmlConfig() {
9494
testUrl("outofpattern*ye", null, handlerMapping, null);
9595
}
9696

97-
void testUrl(String url, Object bean, HandlerMapping handlerMapping, String pathWithinMapping) {
97+
private static void testUrl(String url, Object bean, HandlerMapping handlerMapping, String pathWithinMapping) {
9898
MockServerHttpRequest request = MockServerHttpRequest.method(HttpMethod.GET, URI.create(url)).build();
9999
ServerWebExchange exchange = MockServerWebExchange.from(request);
100100
Object actual = handlerMapping.getHandler(exchange).block();
@@ -127,7 +127,8 @@ void uriTemplateVariables() {
127127
@Configuration
128128
static class WebConfig {
129129

130-
@Bean @SuppressWarnings("unused")
130+
@Bean
131+
@SuppressWarnings("unused")
131132
public SimpleUrlHandlerMapping handlerMapping() {
132133
SimpleUrlHandlerMapping hm = new SimpleUrlHandlerMapping();
133134
hm.registerHandler("/welcome*", otherController());

spring-webmvc/src/test/java/org/springframework/web/servlet/function/DefaultServerRequestTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,6 @@ void bindError() {
409409
);
410410
}
411411

412-
413412
@ParameterizedHttpMethodTest
414413
void checkNotModifiedTimestamp(String method) {
415414
MockHttpServletRequest servletRequest = PathPatternsTestUtils.initRequest(method, "/", true);

0 commit comments

Comments
 (0)