Skip to content

Unnecessary check in PatternsRequestCondition.getMatchingPattern [SPR-10504] #14998

@spring-projects-issues

Description

@spring-projects-issues

Alex Pogrebnyak opened SPR-10504 and commented

On line 259 in org.springframework.web.servlet.mvc.condition.PatternsRequestCondition shipped with version 3.2.2 this block from getMatchingPattern function has unnecessary code.

boolean endsWithSlash = pattern.endsWith("/");
if (this.useTrailingSlashMatch) {
    if (!endsWithSlash && this.pathMatcher.match(pattern + "/", lookupPath)) {
        return pattern +"/";
    }
}

endsWithSlash initialization should be moved inside if statement as it is not used anywhere else in the function


Affects: 3.2.2

Referenced from: commits 4bb0916, 0634555

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions