From 999376f9f94c866c15fa31c8217c7eabeab6bf28 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Mon, 27 Dec 2021 17:33:04 +0100 Subject: [PATCH 1/3] Temporarily remove references to JBoss AS Javadoc See gh-27860 --- build.gradle | 2 -- 1 file changed, 2 deletions(-) diff --git a/build.gradle b/build.gradle index 3f5e29f680..ff9401b48d 100644 --- a/build.gradle +++ b/build.gradle @@ -370,8 +370,6 @@ configure([rootProject] + javaProjects) { project -> "https://docs.oracle.com/javaee/7/api/", "https://docs.oracle.com/cd/E13222_01/wls/docs90/javadocs/", // CommonJ "https://www.ibm.com/docs/api/v1/content/SSEQTP_8.5.5/com.ibm.websphere.javadoc.doc/web/apidocs/", - "https://docs.jboss.org/jbossas/javadoc/4.0.5/connector/", - "https://docs.jboss.org/jbossas/javadoc/7.1.2.Final/", "https://tiles.apache.org/tiles-request/apidocs/", "https://tiles.apache.org/framework/apidocs/", "https://www.eclipse.org/aspectj/doc/released/aspectj5rt-api/", From e1200f34e735769fcc9bac86059d56312460e132 Mon Sep 17 00:00:00 2001 From: Marten Deinum Date: Thu, 16 Dec 2021 07:10:12 +0100 Subject: [PATCH 2/3] Use try-with-resources for AutoClosables where feasible Where unfeasible, this commit adds inline comments to explain why try-with-resources must not be used in certain scenarios. The purpose of the comments is to avoid accidental conversion to try-with-resources at a later date. Closes gh-27823 --- .../context/index/processor/MetadataStore.java | 5 +---- .../core/LocalVariableTableParameterNameDiscoverer.java | 2 ++ .../http/converter/BufferedImageHttpMessageConverter.java | 2 ++ .../http/converter/ResourceHttpMessageConverter.java | 2 ++ .../http/converter/ResourceRegionHttpMessageConverter.java | 2 ++ .../web/socket/messaging/StompSubProtocolHandler.java | 2 ++ 6 files changed, 11 insertions(+), 4 deletions(-) diff --git a/spring-context-indexer/src/main/java/org/springframework/context/index/processor/MetadataStore.java b/spring-context-indexer/src/main/java/org/springframework/context/index/processor/MetadataStore.java index c00f682b77..8593fc7508 100644 --- a/spring-context-indexer/src/main/java/org/springframework/context/index/processor/MetadataStore.java +++ b/spring-context-indexer/src/main/java/org/springframework/context/index/processor/MetadataStore.java @@ -62,12 +62,9 @@ class MetadataStore { private CandidateComponentsMetadata readMetadata(InputStream in) throws IOException { - try { + try (in){ return PropertiesMarshaller.read(in); } - finally { - in.close(); - } } private FileObject getMetadataResource() throws IOException { diff --git a/spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java b/spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java index 6498a35f56..70a2a6adf6 100644 --- a/spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java +++ b/spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java @@ -101,6 +101,8 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD } return NO_DEBUG_INFO_MAP; } + // We cannot use try-with-resources here as, potential, exception upon closing + // would still bubble up the stack try { ClassReader classReader = new ClassReader(is); Map map = new ConcurrentHashMap<>(32); diff --git a/spring-web/src/main/java/org/springframework/http/converter/BufferedImageHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/BufferedImageHttpMessageConverter.java index cdfa5781c9..7a020f25c0 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/BufferedImageHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/BufferedImageHttpMessageConverter.java @@ -169,6 +169,8 @@ public class BufferedImageHttpMessageConverter implements HttpMessageConverter Date: Tue, 4 Jan 2022 15:12:18 +0100 Subject: [PATCH 3/3] Polish contribution See gh-27823 --- .../context/index/processor/MetadataStore.java | 4 ++-- .../core/LocalVariableTableParameterNameDiscoverer.java | 6 +++--- .../http/converter/BufferedImageHttpMessageConverter.java | 6 +++--- .../http/converter/ResourceHttpMessageConverter.java | 6 +++--- .../http/converter/ResourceRegionHttpMessageConverter.java | 6 +++--- .../web/socket/messaging/StompSubProtocolHandler.java | 6 +++--- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/spring-context-indexer/src/main/java/org/springframework/context/index/processor/MetadataStore.java b/spring-context-indexer/src/main/java/org/springframework/context/index/processor/MetadataStore.java index 8593fc7508..8585b89bea 100644 --- a/spring-context-indexer/src/main/java/org/springframework/context/index/processor/MetadataStore.java +++ b/spring-context-indexer/src/main/java/org/springframework/context/index/processor/MetadataStore.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2022 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. @@ -62,7 +62,7 @@ class MetadataStore { private CandidateComponentsMetadata readMetadata(InputStream in) throws IOException { - try (in){ + try (in) { return PropertiesMarshaller.read(in); } } diff --git a/spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java b/spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java index 70a2a6adf6..f20807f119 100644 --- a/spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java +++ b/spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2022 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. @@ -101,8 +101,8 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD } return NO_DEBUG_INFO_MAP; } - // We cannot use try-with-resources here as, potential, exception upon closing - // would still bubble up the stack + // We cannot use try-with-resources here for the InputStream, since we have + // custom handling of the close() method in a finally-block. try { ClassReader classReader = new ClassReader(is); Map map = new ConcurrentHashMap<>(32); diff --git a/spring-web/src/main/java/org/springframework/http/converter/BufferedImageHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/BufferedImageHttpMessageConverter.java index 7a020f25c0..0dbfc02f09 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/BufferedImageHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/BufferedImageHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2022 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. @@ -169,8 +169,8 @@ public class BufferedImageHttpMessageConverter implements HttpMessageConverter