Skip to content

Commit eaa9a78

Browse files
committed
Merge branch '5.1.x'
2 parents ce91620 + 7aa61d9 commit eaa9a78

File tree

12 files changed

+70
-49
lines changed

12 files changed

+70
-49
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ ext {
3434
groovyVersion = "2.5.6"
3535
hsqldbVersion = "2.4.1"
3636
jackson2Version = "2.9.8"
37-
jettyVersion = "9.4.17.v20190418"
37+
jettyVersion = "9.4.18.v20190429"
3838
junit5Version = "5.4.2"
3939
kotlinVersion = "1.3.31"
4040
log4jVersion = "2.11.2"
41-
nettyVersion = "4.1.35.Final"
41+
nettyVersion = "4.1.36.Final"
4242
reactorVersion = "Dysprosium-BUILD-SNAPSHOT"
4343
rxjavaVersion = "1.3.8"
4444
rxjavaAdapterVersion = "1.2.1"

spring-core/src/main/java/org/springframework/core/type/filter/AbstractTypeHierarchyTraversingFilter.java

Lines changed: 9 additions & 5 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.
@@ -85,8 +85,10 @@ public boolean match(MetadataReader metadataReader, MetadataReaderFactory metada
8585
}
8686
}
8787
catch (IOException ex) {
88-
logger.debug("Could not read super class [" + metadata.getSuperClassName() +
89-
"] of type-filtered class [" + metadata.getClassName() + "]");
88+
if (logger.isDebugEnabled()) {
89+
logger.debug("Could not read super class [" + metadata.getSuperClassName() +
90+
"] of type-filtered class [" + metadata.getClassName() + "]");
91+
}
9092
}
9193
}
9294
}
@@ -109,8 +111,10 @@ public boolean match(MetadataReader metadataReader, MetadataReaderFactory metada
109111
}
110112
}
111113
catch (IOException ex) {
112-
logger.debug("Could not read interface [" + ifc + "] for type-filtered class [" +
113-
metadata.getClassName() + "]");
114+
if (logger.isDebugEnabled()) {
115+
logger.debug("Could not read interface [" + ifc + "] for type-filtered class [" +
116+
metadata.getClassName() + "]");
117+
}
114118
}
115119
}
116120
}

spring-core/src/main/java/org/springframework/util/SerializationUtils.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 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.
@@ -43,8 +43,7 @@ public static byte[] serialize(@Nullable Object object) {
4343
return null;
4444
}
4545
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
46-
try {
47-
ObjectOutputStream oos = new ObjectOutputStream(baos);
46+
try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
4847
oos.writeObject(object);
4948
oos.flush();
5049
}
@@ -64,8 +63,7 @@ public static Object deserialize(@Nullable byte[] bytes) {
6463
if (bytes == null) {
6564
return null;
6665
}
67-
try {
68-
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes));
66+
try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes))) {
6967
return ois.readObject();
7068
}
7169
catch (IOException ex) {

spring-core/src/test/java/org/springframework/util/SerializationTestUtils.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 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.
@@ -34,8 +34,9 @@ public class SerializationTestUtils {
3434

3535
public static void testSerialization(Object o) throws IOException {
3636
OutputStream baos = new ByteArrayOutputStream();
37-
ObjectOutputStream oos = new ObjectOutputStream(baos);
38-
oos.writeObject(o);
37+
try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
38+
oos.writeObject(o);
39+
}
3940
}
4041

4142
public static boolean isSerializable(Object o) throws IOException {
@@ -50,16 +51,17 @@ public static boolean isSerializable(Object o) throws IOException {
5051

5152
public static Object serializeAndDeserialize(Object o) throws IOException, ClassNotFoundException {
5253
ByteArrayOutputStream baos = new ByteArrayOutputStream();
53-
ObjectOutputStream oos = new ObjectOutputStream(baos);
54-
oos.writeObject(o);
55-
oos.flush();
54+
try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
55+
oos.writeObject(o);
56+
oos.flush();
57+
}
5658
baos.flush();
5759
byte[] bytes = baos.toByteArray();
5860

5961
ByteArrayInputStream is = new ByteArrayInputStream(bytes);
60-
ObjectInputStream ois = new ObjectInputStream(is);
61-
Object o2 = ois.readObject();
62-
return o2;
62+
try (ObjectInputStream ois = new ObjectInputStream(is)) {
63+
return ois.readObject();
64+
}
6365
}
6466

6567
}

spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/AbstractEmbeddedDatabaseConfigurer.java

Lines changed: 5 additions & 2 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.
@@ -18,6 +18,7 @@
1818

1919
import java.sql.Connection;
2020
import java.sql.SQLException;
21+
import java.sql.Statement;
2122
import javax.sql.DataSource;
2223

2324
import org.apache.commons.logging.Log;
@@ -42,7 +43,9 @@ public void shutdown(DataSource dataSource, String databaseName) {
4243
try {
4344
con = dataSource.getConnection();
4445
if (con != null) {
45-
con.createStatement().execute("SHUTDOWN");
46+
try (Statement stmt = con.createStatement()) {
47+
stmt.execute("SHUTDOWN");
48+
}
4649
}
4750
}
4851
catch (SQLException ex) {

spring-jdbc/src/main/java/org/springframework/jdbc/support/CustomSQLExceptionTranslatorRegistry.java

Lines changed: 10 additions & 8 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.
@@ -74,13 +74,15 @@ private CustomSQLExceptionTranslatorRegistry() {
7474
*/
7575
public void registerTranslator(String dbName, SQLExceptionTranslator translator) {
7676
SQLExceptionTranslator replaced = this.translatorMap.put(dbName, translator);
77-
if (replaced != null) {
78-
logger.debug("Replacing custom translator [" + replaced + "] for database '" + dbName +
79-
"' with [" + translator + "]");
80-
}
81-
else {
82-
logger.debug("Adding custom translator of type [" + translator.getClass().getName() +
83-
"] for database '" + dbName + "'");
77+
if (logger.isDebugEnabled()) {
78+
if (replaced != null) {
79+
logger.debug("Replacing custom translator [" + replaced + "] for database '" + dbName +
80+
"' with [" + translator + "]");
81+
}
82+
else {
83+
logger.debug("Adding custom translator of type [" + translator.getClass().getName() +
84+
"] for database '" + dbName + "'");
85+
}
8486
}
8587
}
8688

spring-jms/src/main/java/org/springframework/jms/listener/endpoint/DefaultJmsActivationSpecFactory.java

Lines changed: 13 additions & 5 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.
@@ -85,7 +85,9 @@ protected Class<?> determineActivationSpecClass(ResourceAdapter adapter) {
8585
return adapter.getClass().getClassLoader().loadClass(specClassName);
8686
}
8787
catch (ClassNotFoundException ex) {
88-
logger.debug("No default <Provider>ActivationSpec class found: " + specClassName);
88+
if (logger.isDebugEnabled()) {
89+
logger.debug("No default <Provider>ActivationSpec class found: " + specClassName);
90+
}
8991
}
9092
}
9193

@@ -98,7 +100,9 @@ else if (adapterClassName.endsWith(RESOURCE_ADAPTER_IMPL_SUFFIX)){
98100
return adapter.getClass().getClassLoader().loadClass(specClassName);
99101
}
100102
catch (ClassNotFoundException ex) {
101-
logger.debug("No default <Provider>ActivationSpecImpl class found: " + specClassName);
103+
if (logger.isDebugEnabled()) {
104+
logger.debug("No default <Provider>ActivationSpecImpl class found: " + specClassName);
105+
}
102106
}
103107
}
104108

@@ -109,7 +113,9 @@ else if (adapterClassName.endsWith(RESOURCE_ADAPTER_IMPL_SUFFIX)){
109113
return adapter.getClass().getClassLoader().loadClass(specClassName);
110114
}
111115
catch (ClassNotFoundException ex) {
112-
logger.debug("No default ActivationSpecImpl class found in provider package: " + specClassName);
116+
if (logger.isDebugEnabled()) {
117+
logger.debug("No default ActivationSpecImpl class found in provider package: " + specClassName);
118+
}
113119
}
114120

115121
// ActivationSpecImpl class in "inbound" subpackage (WebSphere MQ 6.0.2.1)
@@ -118,7 +124,9 @@ else if (adapterClassName.endsWith(RESOURCE_ADAPTER_IMPL_SUFFIX)){
118124
return adapter.getClass().getClassLoader().loadClass(specClassName);
119125
}
120126
catch (ClassNotFoundException ex) {
121-
logger.debug("No default ActivationSpecImpl class found in inbound subpackage: " + specClassName);
127+
if (logger.isDebugEnabled()) {
128+
logger.debug("No default ActivationSpecImpl class found in inbound subpackage: " + specClassName);
129+
}
122130
}
123131

124132
throw new IllegalStateException("No ActivationSpec class defined - " +

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

Lines changed: 3 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.
@@ -64,8 +64,8 @@ private MediaTypeFactory() {
6464
* @return a multi-value map, mapping media types to file extensions.
6565
*/
6666
private static MultiValueMap<String, MediaType> parseMimeTypes() {
67-
try (InputStream is = MediaTypeFactory.class.getResourceAsStream(MIME_TYPES_FILE_NAME)) {
68-
BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.US_ASCII));
67+
InputStream is = MediaTypeFactory.class.getResourceAsStream(MIME_TYPES_FILE_NAME);
68+
try (BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.US_ASCII))) {
6969
MultiValueMap<String, MediaType> result = new LinkedMultiValueMap<>();
7070
String line;
7171
while ((line = reader.readLine()) != null) {

spring-web/src/main/java/org/springframework/web/method/annotation/AbstractWebArgumentResolverAdapter.java

Lines changed: 4 additions & 2 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.
@@ -81,7 +81,9 @@ public boolean supportsParameter(MethodParameter parameter) {
8181
}
8282
catch (Exception ex) {
8383
// ignore (see class-level doc)
84-
logger.debug("Error in checking support for parameter [" + parameter + "], message: " + ex.getMessage());
84+
if (logger.isDebugEnabled()) {
85+
logger.debug("Error in checking support for parameter [" + parameter + "]: " + ex.getMessage());
86+
}
8587
return false;
8688
}
8789
}

spring-webflux/src/main/java/org/springframework/web/reactive/resource/CachingResourceTransformer.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 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.
@@ -69,7 +69,9 @@ public Mono<Resource> transform(ServerWebExchange exchange, Resource resource,
6969

7070
Resource cachedResource = this.cache.get(resource, Resource.class);
7171
if (cachedResource != null) {
72-
logger.trace(exchange.getLogPrefix() + "Resource resolved from cache");
72+
if (logger.isTraceEnabled()) {
73+
logger.trace(exchange.getLogPrefix() + "Resource resolved from cache");
74+
}
7375
return Mono.just(cachedResource);
7476
}
7577

spring-webmvc/src/main/java/org/springframework/web/servlet/i18n/LocaleChangeInterceptor.java

Lines changed: 4 additions & 2 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.
@@ -154,7 +154,9 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
154154
}
155155
catch (IllegalArgumentException ex) {
156156
if (isIgnoreInvalidLocale()) {
157-
logger.debug("Ignoring invalid locale value [" + newLocale + "]: " + ex.getMessage());
157+
if (logger.isDebugEnabled()) {
158+
logger.debug("Ignoring invalid locale value [" + newLocale + "]: " + ex.getMessage());
159+
}
158160
}
159161
else {
160162
throw ex;

spring-webmvc/src/main/java/org/springframework/web/servlet/resource/CachingResourceTransformer.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 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.
@@ -71,9 +71,7 @@ public Resource transform(HttpServletRequest request, Resource resource, Resourc
7171

7272
Resource transformed = this.cache.get(resource, Resource.class);
7373
if (transformed != null) {
74-
if (logger.isTraceEnabled()) {
75-
logger.trace("Resource resolved from cache");
76-
}
74+
logger.trace("Resource resolved from cache");
7775
return transformed;
7876
}
7977

0 commit comments

Comments
 (0)