Commit Graph

2607 Commits

Author SHA1 Message Date
Juergen Hoeller 66732afc10 Merge branch '5.3.x'
# Conflicts:
#	build.gradle
#	spring-jms/src/main/java/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java
2022-01-19 13:56:37 +01:00
Juergen Hoeller 86be03945b Polishing 2022-01-19 13:54:03 +01:00
Sam Brannen 198576dbc5 Merge branch '5.3.x' 2022-01-13 16:21:16 +01:00
Sam Brannen 4b1b25496b Improve comment parsing in DTD/XSD detection algorithm
Prior to this commit, XmlValidationModeDetector did not properly parse
all categories of comments (described below). When such categories of
comments were encountered XmlValidationModeDetector may have
incorrectly detected that an XML file used a DTD when it used an XSD,
or vice versa.

This commit revises the parsing algorithm in XmlValidationModeDetector
so that multi-line comments and multiple comments on a single line are
properly recognized.

Specifically, with this commit the following categories of comments are
now handled properly.

- Multiple comments on a single line
- Multi-line comment: beginning on one line and then ending on another
  line with an additional comment following on that same line.
- Multi-line comment: beginning at the end of XML content on one line
  and then spanning multiple lines.

Closes gh-27915
2022-01-13 16:11:15 +01:00
Sam Brannen 9e8b6feb54 Polishing 2022-01-13 14:56:14 +01:00
Sam Brannen 5aefcd2fdb Re-enable BlockHound integration tests
Prior to this commit, our BlockHound integration tests were disabled
after the migration to a JDK 17 baseline since the build now always
runs on JDK 14 or higher.

To re-enable the tests we now supply the deprecated
-XX:+AllowRedefinitionToAddDeleteMethods command-line argument to the JVM
for tests in the Gradle build. Users can also configure this manually
within an IDE to run SpringCoreBlockHoundIntegrationTests.

If that command-line argument is removed from the JVM at some point in
the future, we will need to investigate an alternative solution.

See https://github.com/reactor/BlockHound/issues/33 for details.
2022-01-11 14:54:59 +01:00
Sam Brannen f2fe8a87fa Polish contribution
See gh-27862
2022-01-11 14:11:07 +01:00
v_vyqyxiong 6ecb488327 Remove unnecessary check in isBridgedCandidateFor()
In BridgeMethodResolver#isBridgedCandidateFor, candidateMethod is never
not bridged, so it's unnecessary to judge whether candidateMethod and
bridgeMethod are the same.

Closes gh-27862
2022-01-11 14:03:57 +01:00
Sam Brannen d57bc176f2 Merge branch '5.3.x' 2022-01-10 14:21:25 +01:00
Sam Brannen df263d01b9 Use idiomatic AssertJ assertions for true, false, and null 2022-01-10 14:15:55 +01:00
Sam Brannen 4ebc53a424 Merge branch '5.3.x' 2022-01-10 13:28:31 +01:00
kuanghc1 2a80b64d40 Add tests for StringUtils matchesCharacter() method
Closes gh-27909
2022-01-10 13:27:15 +01:00
Sam Brannen 519fa60c25 Merge branch '5.3.x' 2022-01-09 17:12:49 +01:00
Sam Brannen 8087eb69bf Improve error message in ResolvableType.forClassWithGenerics()
Prior to this commit, the error message generated for a mismatched
number of generics did not include the information about the class in
question.

This commit improves the error message by providing more context,
specifically the result of invoking toGenericString() on the class.

For example, instead of throwing an IllegalArgumentException with the
error message "Mismatched number of generics specified", the error
message would now be "Mismatched number of generics specified for
public abstract interface java.util.Map<K,V>".

Closes gh-27847
2022-01-09 17:05:07 +01:00
Sam Brannen e41d865193 Polishing 2022-01-09 17:05:07 +01:00
Sam Brannen 5d508de2c0 Merge branch '5.3.x' 2022-01-09 16:17:42 +01:00
Sam Brannen d68bb4eecd Simplify StreamConverterTests 2022-01-09 16:15:32 +01:00
Sam Brannen 730ad4436f Polish contribution 2022-01-09 16:15:32 +01:00
kth496 23ab9ca8ca Refactor tests to use lambda expressions & method references
Closes gh-27386
2022-01-09 15:37:54 +01:00
Sam Brannen 202b7ea47b Merge branch '5.3.x' 2022-01-04 15:17:05 +01:00
Sam Brannen c3ce4f0f90 Polish contribution
See gh-27823
2022-01-04 15:12:29 +01:00
Marten Deinum e1200f34e7 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
2022-01-04 15:12:29 +01:00
Marten Deinum 941b6af9ac Use Collection factory methods when applicable
This commit replaces the use of Collections.unmodifiableList/Set/Map
with the corresponding 'of(...)' factory methods introduced in Java 9.

Closes gh-27824
2022-01-04 12:01:13 +01:00
liuzhifei 7021eb5bb1 Apply "instanceof pattern matching" in additional locations
Closes gh-27696
2022-01-03 16:52:38 +01:00
Stephane Nicoll ca6911a532 Update copyright year of changed file
See gh-24636
2021-12-21 09:49:08 +01:00
陈其苗 dbbdd044cd Use Collections.addAll instead of Collection.addAll
See gh-24636
2021-12-21 09:47:30 +01:00
Juergen Hoeller 96e2fc69ed Merge branch '5.3.x'
# Conflicts:
#	build.gradle
#	spring-core/src/main/java/org/springframework/core/type/StandardAnnotationMetadata.java
#	spring-core/src/main/java/org/springframework/core/type/classreading/SimpleAnnotationMetadata.java
2021-12-15 18:03:51 +01:00
Juergen Hoeller 1885ab3e07 Polishing 2021-12-15 17:58:28 +01:00
Juergen Hoeller 50c7c84886 Introduce getDeclaredMethods() for MethodMetadata of all user-declared methods
Closes gh-27701
2021-12-15 13:32:42 +01:00
Juergen Hoeller bfdb93b406 Merge branch '5.3.x'
# Conflicts:
#	build.gradle
#	src/docs/asciidoc/integration.adoc
2021-12-14 16:51:00 +01:00
Juergen Hoeller ac581bed92 Avoid NPE against null value from toString call
Closes gh-27782
2021-12-14 16:46:42 +01:00
Juergen Hoeller 0802581aff Unit test for identifying type variable argument
See gh-27748
2021-12-14 16:46:26 +01:00
Juergen Hoeller aeff664cf9 Polishing 2021-12-14 09:46:52 +01:00
Rossen Stoyanchev 3a43ca3a34 Merge branch '5.3.x' into main 2021-12-08 11:41:02 +00:00
Rossen Stoyanchev 99c7608ffe Replace both EOL and control characters 2021-12-08 11:25:38 +00:00
Arjen Poutsma 81af7330f6 Deprecate StringUtils::trimWhitespace and variants
This commits deprecates
- StringUtils::trimWhitespace in favor of String::strip
- StringUtils::trimLeadingWhitespace in favor of String::stripLeading
- StringUtils::trimTrailingWhitespace in favor of String::stripTrailing

Closes gh-27769
2021-12-06 13:37:16 +01:00
liuzhifei 68cf95f499 Use String::strip in StringUtils::trimWhitespace
See gh-27703
2021-12-06 11:29:43 +01:00
Juergen Hoeller 7f43128a0e Merge branch '5.3.x'
# Conflicts:
#	build.gradle
#	spring-web/src/main/java/org/springframework/web/server/MediaTypeNotSupportedStatusException.java
#	spring-web/src/main/java/org/springframework/web/util/ContentCachingRequestWrapper.java
#	spring-webmvc/src/main/java/org/springframework/web/servlet/handler/HandlerMappingIntrospector.java
2021-12-03 22:42:05 +01:00
Juergen Hoeller 7c834d98c2 Upgrade to ASM master (including early support for Java 19 bytecode)
Closes gh-27740
2021-12-03 22:32:26 +01:00
Stephane Nicoll e986ff8d07 Update copyright year of changed files
See gh-27239
2021-12-02 11:32:46 +01:00
Frederick Zhang baed0785fd Replace XMLReaderFactory with SAXParserFactory
XMLReaderFactory has been marked as deprecated and without additional
configuration, and it's slower than SAXParserFactory.

Previously `XMLReaderFactory.createXMLReader()` is called upon every
request. This is an anti-pattern as mentioned in [1] and it can be very
slow since it loads the jar service file unless a parser has been
pre-assigned [2] (e.g. by setting org.xml.sax.driver).

SAXParserFactory uses a FactoryFinder [3] instead, which takes advantage
of a thread-local cache provided by ServiceLoader. Developers can still
pre-assign a factory by setting javax.xml.parsers.SAXParserFactory to
make it faster.

[1] https://bugs.openjdk.java.net/browse/JDK-6925410
[2] c8add223a1/src/java.xml/share/classes/org/xml/sax/helpers/XMLReaderFactory.java (L144-L148)
[3] 66c653c561/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java (L181-L185)

See gh-27239
2021-12-02 11:32:46 +01:00
Stephane Nicoll 46cb5ab135 Polish contribution
See gh-23813
2021-11-30 14:29:05 +01:00
Johnny Lim 5c4cde7853 Polish AbstractResource
See gh-23813
2021-11-30 14:25:40 +01:00
Arjen Poutsma 6d9136013e Refactor MimeType/MediaType specificity
This commit makes several changes to MimeType and MediaType
related to the topic of specificity.

This commit deprecates the MimeType and MediaType Comparators.
Comparators require a transitive relationship, and the desired order for
these types is not transitive (see #27488).

Instead, this commit introduces two new MimeType methods: isMoreSpecific
and isLessSpecific, both of which return booleans. MediaType overrides
these methods to include the quality factor (q) in the comparison.

All MediaType sorting methods have been deprecated in favor of
MimeTypeUtils::sortBySpecificity.  This sorting method now uses
MimeType::isLessSpecific in combination a bubble sort algorithm (which
does not require a transitive compare function).

Closes gh-27580
2021-11-23 11:49:01 +01:00
Juergen Hoeller 4750a9430c Early removal of 5.x-deprecated code
Closes gh-27686
2021-11-18 09:18:06 +01:00
Arjen Poutsma 17cdd97c37 Merge branch '5.3.x' 2021-11-17 16:57:02 +01:00
Arjen Poutsma 5fbdd6dcfe Throw exception using capturing patterns in AntPathMatcher
Closes gh-27688
2021-11-17 16:52:17 +01:00
SungMin 32af39d6e6
Use 'toString(Charset)' instead of 'toString(String)' for encodings (#27646)
Co-authored-by: 홍성민(SungMin Hong)/Platform Engineering팀/11ST <devmonster@11stcorp.com>
2021-11-10 15:11:33 +01:00
Rossen Stoyanchev ec947065a9 Merge branch '5.3.x' into main 2021-11-09 10:23:14 +00:00
Rossen Stoyanchev c5de5c9939 Update Javadoc of LogFormatUtils
Closes gh-27632
2021-11-08 21:21:54 +00:00