Skip to content

Commit

Permalink
Merge pull request #38944 from FBibonne
Browse files Browse the repository at this point in the history
* pr/38944:
  Polish "Fix error mark position for PatternParseException"
  Fix error mark position for PatternParseException

Closes gh-38944
  • Loading branch information
mhalbritter committed Jan 10, 2024
2 parents 52a4097 + 47e8f61 commit a0b034d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'.");
Expand Down

0 comments on commit a0b034d

Please sign in to comment.