Skip to content

Commit 2e63c66

Browse files
committed
Merge branch '5.1.x'
2 parents 3ac88be + 0babc1f commit 2e63c66

File tree

5 files changed

+19
-12
lines changed

5 files changed

+19
-12
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ public DocumentDefaultsDefinition getDefaults() {
377377
*/
378378
public BeanDefinitionDefaults getBeanDefinitionDefaults() {
379379
BeanDefinitionDefaults bdd = new BeanDefinitionDefaults();
380-
bdd.setLazyInit("TRUE".equalsIgnoreCase(this.defaults.getLazyInit()));
380+
bdd.setLazyInit(TRUE_VALUE.equalsIgnoreCase(this.defaults.getLazyInit()));
381381
bdd.setAutowireMode(getAutowireMode(DEFAULT_VALUE));
382382
bdd.setInitMethodName(this.defaults.getInitMethod());
383383
bdd.setDestroyMethodName(this.defaults.getDestroyMethod());

spring-core/src/main/java/org/springframework/core/log/LogFormatUtils.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -82,8 +82,9 @@ public static String formatValue(@Nullable Object value, boolean limitLength) {
8282
*/
8383
public static void traceDebug(Log logger, Function<Boolean, String> messageFactory) {
8484
if (logger.isDebugEnabled()) {
85-
String logMessage = messageFactory.apply(logger.isTraceEnabled());
86-
if (logger.isTraceEnabled()) {
85+
boolean traceEnabled = logger.isTraceEnabled();
86+
String logMessage = messageFactory.apply(traceEnabled);
87+
if (traceEnabled) {
8788
logger.trace(logMessage);
8889
}
8990
else {

spring-web/src/main/java/org/springframework/http/HttpHeaders.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
* <li>{@link #set(String, String)} sets the header value to a single string value</li>
6565
* </ul>
6666
*
67+
* <p>Note that {@code HttpHeaders} generally treats header names in a case-insensitive manner.
68+
*
6769
* @author Arjen Poutsma
6870
* @author Sebastien Deleuze
6971
* @author Brian Clozel
@@ -416,13 +418,17 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
416418

417419
/**
418420
* Construct a new, empty instance of the {@code HttpHeaders} object.
421+
* <p>This is the common constructor, using a case-insensitive map structure.
419422
*/
420423
public HttpHeaders() {
421424
this(CollectionUtils.toMultiValueMap(new LinkedCaseInsensitiveMap<>(8, Locale.ENGLISH)));
422425
}
423426

424427
/**
425428
* Construct a new {@code HttpHeaders} instance backed by an existing map.
429+
* <p>This constructor is available as an optimization for adapting to existing
430+
* headers map structures, primarily for internal use within the framework.
431+
* @param headers the headers map (expected to operate with case-insensitive keys)
426432
* @since 5.1
427433
*/
428434
public HttpHeaders(MultiValueMap<String, String> headers) {

spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMapping.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public Object getDefaultHandler() {
117117
public void setAlwaysUseFullPath(boolean alwaysUseFullPath) {
118118
this.urlPathHelper.setAlwaysUseFullPath(alwaysUseFullPath);
119119
if (this.corsConfigurationSource instanceof UrlBasedCorsConfigurationSource) {
120-
((UrlBasedCorsConfigurationSource)this.corsConfigurationSource).setAlwaysUseFullPath(alwaysUseFullPath);
120+
((UrlBasedCorsConfigurationSource) this.corsConfigurationSource).setAlwaysUseFullPath(alwaysUseFullPath);
121121
}
122122
}
123123

@@ -128,7 +128,7 @@ public void setAlwaysUseFullPath(boolean alwaysUseFullPath) {
128128
public void setUrlDecode(boolean urlDecode) {
129129
this.urlPathHelper.setUrlDecode(urlDecode);
130130
if (this.corsConfigurationSource instanceof UrlBasedCorsConfigurationSource) {
131-
((UrlBasedCorsConfigurationSource)this.corsConfigurationSource).setUrlDecode(urlDecode);
131+
((UrlBasedCorsConfigurationSource) this.corsConfigurationSource).setUrlDecode(urlDecode);
132132
}
133133
}
134134

@@ -139,7 +139,7 @@ public void setUrlDecode(boolean urlDecode) {
139139
public void setRemoveSemicolonContent(boolean removeSemicolonContent) {
140140
this.urlPathHelper.setRemoveSemicolonContent(removeSemicolonContent);
141141
if (this.corsConfigurationSource instanceof UrlBasedCorsConfigurationSource) {
142-
((UrlBasedCorsConfigurationSource)this.corsConfigurationSource).setRemoveSemicolonContent(removeSemicolonContent);
142+
((UrlBasedCorsConfigurationSource) this.corsConfigurationSource).setRemoveSemicolonContent(removeSemicolonContent);
143143
}
144144
}
145145

@@ -153,7 +153,7 @@ public void setUrlPathHelper(UrlPathHelper urlPathHelper) {
153153
Assert.notNull(urlPathHelper, "UrlPathHelper must not be null");
154154
this.urlPathHelper = urlPathHelper;
155155
if (this.corsConfigurationSource instanceof UrlBasedCorsConfigurationSource) {
156-
((UrlBasedCorsConfigurationSource)this.corsConfigurationSource).setUrlPathHelper(urlPathHelper);
156+
((UrlBasedCorsConfigurationSource) this.corsConfigurationSource).setUrlPathHelper(urlPathHelper);
157157
}
158158
}
159159

@@ -173,7 +173,7 @@ public void setPathMatcher(PathMatcher pathMatcher) {
173173
Assert.notNull(pathMatcher, "PathMatcher must not be null");
174174
this.pathMatcher = pathMatcher;
175175
if (this.corsConfigurationSource instanceof UrlBasedCorsConfigurationSource) {
176-
((UrlBasedCorsConfigurationSource)this.corsConfigurationSource).setPathMatcher(pathMatcher);
176+
((UrlBasedCorsConfigurationSource) this.corsConfigurationSource).setPathMatcher(pathMatcher);
177177
}
178178
}
179179

spring-webmvc/src/test/java/org/springframework/web/servlet/config/MvcNamespaceTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public class MvcNamespaceTests {
169169

170170

171171
@Before
172-
public void setUp() throws Exception {
172+
public void setup() throws Exception {
173173
TestMockServletContext servletContext = new TestMockServletContext();
174174
appContext = new XmlWebApplicationContext();
175175
appContext.setServletContext(servletContext);
@@ -889,7 +889,7 @@ public void testCorsMinimal() throws Exception {
889889
AbstractHandlerMapping handlerMapping = (AbstractHandlerMapping)appContext.getBean(beanName);
890890
assertNotNull(handlerMapping);
891891
DirectFieldAccessor accessor = new DirectFieldAccessor(handlerMapping);
892-
Map<String, CorsConfiguration> configs = ((UrlBasedCorsConfigurationSource)accessor
892+
Map<String, CorsConfiguration> configs = ((UrlBasedCorsConfigurationSource) accessor
893893
.getPropertyValue("corsConfigurationSource")).getCorsConfigurations();
894894
assertNotNull(configs);
895895
assertEquals(1, configs.size());
@@ -914,7 +914,7 @@ public void testCors() throws Exception {
914914
AbstractHandlerMapping handlerMapping = (AbstractHandlerMapping)appContext.getBean(beanName);
915915
assertNotNull(handlerMapping);
916916
DirectFieldAccessor accessor = new DirectFieldAccessor(handlerMapping);
917-
Map<String, CorsConfiguration> configs = ((UrlBasedCorsConfigurationSource)accessor
917+
Map<String, CorsConfiguration> configs = ((UrlBasedCorsConfigurationSource) accessor
918918
.getPropertyValue("corsConfigurationSource")).getCorsConfigurations();
919919
assertNotNull(configs);
920920
assertEquals(2, configs.size());

0 commit comments

Comments
 (0)