Skip to content

Commit e3f203a

Browse files
committed
Polish
1 parent 441beee commit e3f203a

File tree

3 files changed

+6
-18
lines changed

3 files changed

+6
-18
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ public void customize(Connector connector) {
477477
}
478478

479479
factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {
480+
480481
@Override
481482
public void customize(Connector connector) {
482483
ProtocolHandler handler = connector.getProtocolHandler();
@@ -489,14 +490,15 @@ public void customize(Connector connector) {
489490
}
490491

491492
private String coerceCompression(String compression) {
492-
if (Boolean.toString(true).equals(compression)) {
493+
if ("true".equalsIgnoreCase(compression)) {
493494
return "on";
494495
}
495-
else if (Boolean.toString(false).equals(compression)) {
496+
if ("false".equalsIgnoreCase(compression)) {
496497
return "off";
497498
}
498499
return compression;
499500
}
501+
500502
});
501503

502504
if (this.accessLogEnabled) {

spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,13 @@ public void customTomcatCompression() throws Exception {
205205
@Test
206206
public void disableTomcatCompressionWithYaml() throws Exception {
207207
// YAML interprets "off" as false, check that it's mapped back to off
208-
assertThat("off", is(equalTo(configureCompression("false"))));
208+
assertThat("off", is(equalTo(configureCompression("faLSe"))));
209209
}
210210

211211
@Test
212212
public void enableTomcatCompressionWithYaml() throws Exception {
213213
// YAML interprets "on" as true, check that it's mapped back to on
214-
assertThat("on", is(equalTo(configureCompression("true"))));
214+
assertThat("on", is(equalTo(configureCompression("trUE"))));
215215
}
216216

217217
@Test

spring-boot/src/test/java/org/springframework/boot/context/web/ErrorPageFilterTests.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,7 @@ public void doFilter(ServletRequest request, ServletResponse response)
325325
@Test
326326
public void responseIsNotCommitedWhenRequestIsAsync() throws Exception {
327327
this.request.setAsyncStarted(true);
328-
329328
this.filter.doFilter(this.request, this.response, this.chain);
330-
331329
assertThat(this.chain.getRequest(), equalTo((ServletRequest) this.request));
332330
assertThat(((HttpServletResponseWrapper) this.chain.getResponse()).getResponse(),
333331
equalTo((ServletResponse) this.response));
@@ -347,9 +345,7 @@ public void doFilter(ServletRequest request, ServletResponse response)
347345
throw new RuntimeException("BAD");
348346
}
349347
};
350-
351348
this.filter.doFilter(this.request, this.response, this.chain);
352-
353349
assertThat(this.chain.getRequest(), equalTo((ServletRequest) this.request));
354350
assertThat(((HttpServletResponseWrapper) this.chain.getResponse()).getResponse(),
355351
equalTo((ServletResponse) this.response));
@@ -368,9 +364,7 @@ public void doFilter(ServletRequest request, ServletResponse response)
368364
((HttpServletResponse) response).sendError(400, "BAD");
369365
}
370366
};
371-
372367
this.filter.doFilter(this.request, this.response, this.chain);
373-
374368
assertThat(this.chain.getRequest(), equalTo((ServletRequest) this.request));
375369
assertThat(((HttpServletResponseWrapper) this.chain.getResponse()).getResponse(),
376370
equalTo((ServletResponse) this.response));
@@ -380,9 +374,7 @@ public void doFilter(ServletRequest request, ServletResponse response)
380374
@Test
381375
public void responseIsNotCommitedDuringAsyncDispatch() throws Exception {
382376
setUpAsyncDispatch();
383-
384377
this.filter.doFilter(this.request, this.response, this.chain);
385-
386378
assertThat(this.chain.getRequest(), equalTo((ServletRequest) this.request));
387379
assertThat(((HttpServletResponseWrapper) this.chain.getResponse()).getResponse(),
388380
equalTo((ServletResponse) this.response));
@@ -402,9 +394,7 @@ public void doFilter(ServletRequest request, ServletResponse response)
402394
throw new RuntimeException("BAD");
403395
}
404396
};
405-
406397
this.filter.doFilter(this.request, this.response, this.chain);
407-
408398
assertThat(this.chain.getRequest(), equalTo((ServletRequest) this.request));
409399
assertThat(((HttpServletResponseWrapper) this.chain.getResponse()).getResponse(),
410400
equalTo((ServletResponse) this.response));
@@ -424,9 +414,7 @@ public void doFilter(ServletRequest request, ServletResponse response)
424414
((HttpServletResponse) response).sendError(400, "BAD");
425415
}
426416
};
427-
428417
this.filter.doFilter(this.request, this.response, this.chain);
429-
430418
assertThat(this.chain.getRequest(), equalTo((ServletRequest) this.request));
431419
assertThat(((HttpServletResponseWrapper) this.chain.getResponse()).getResponse(),
432420
equalTo((ServletResponse) this.response));
@@ -439,9 +427,7 @@ public void responseIsNotFlushedIfStatusIsLessThan400AndItHasAlreadyBeenCommitte
439427
HttpServletResponse committedResponse = mock(HttpServletResponse.class);
440428
given(committedResponse.isCommitted()).willReturn(true);
441429
given(committedResponse.getStatus()).willReturn(200);
442-
443430
this.filter.doFilter(this.request, committedResponse, this.chain);
444-
445431
verify(committedResponse, times(0)).flushBuffer();
446432
}
447433

0 commit comments

Comments
 (0)