Merge branch '3.1.x' into 3.2.x

Closes gh-39075
This commit is contained in:
Moritz Halbritter 2024-01-10 09:41:41 +01:00
commit 748a80c448
2 changed files with 3 additions and 2 deletions

View File

@ -30,7 +30,7 @@ class PatternParseFailureAnalyzer extends AbstractFailureAnalyzer<PatternParseEx
@Override
protected FailureAnalysis analyze(Throwable rootFailure, PatternParseException cause) {
return new FailureAnalysis("Invalid mapping pattern detected: " + cause.toDetailedString(),
return new FailureAnalysis("Invalid mapping pattern detected:\n" + cause.toDetailedString(),
"Fix this pattern in your application or switch to the legacy parser implementation with "
+ "'spring.mvc.pathmatch.matching-strategy=ant_path_matcher'.",
cause);

View File

@ -36,7 +36,8 @@ class PatternParseFailureAnalyzerTests {
@Test
void patternParseFailureQuotesPattern() {
FailureAnalysis failureAnalysis = performAnalysis("/spring/**/framework");
assertThat(failureAnalysis.getDescription()).contains("Invalid mapping pattern detected: /spring/**/framework");
assertThat(failureAnalysis.getDescription())
.contains("Invalid mapping pattern detected:\n" + "/spring/**/framework\n" + " ^");
assertThat(failureAnalysis.getAction())
.contains("Fix this pattern in your application or switch to the legacy parser"
+ " implementation with 'spring.mvc.pathmatch.matching-strategy=ant_path_matcher'.");