Skip to content

Commit

Permalink
Fix UrlPathHelper#shouldRemoveSemicolonContent()
Browse files Browse the repository at this point in the history
The checkReadOnly() method should only be called from
methods that modify properties to prevent modification
of read-only instances.

Fixes spring-projects#27256
  • Loading branch information
evpaassen committed Aug 20, 2021
1 parent 9f7a940 commit 51a1731
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ public void setRemoveSemicolonContent(boolean removeSemicolonContent) {
* Whether configured to remove ";" (semicolon) content from the request URI.
*/
public boolean shouldRemoveSemicolonContent() {
checkReadOnly();
return this.removeSemicolonContent;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.springframework.web.testfixture.servlet.MockHttpServletRequest;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;

/**
* Unit tests for {@link UrlPathHelper}.
Expand Down Expand Up @@ -165,6 +166,11 @@ public void getLookupPathWithSemicolonContentAndNullPathInfo() {
assertThat(helper.getLookupPathForRequest(request)).isEqualTo("/welcome.html;c=d");
}

@Test // gh-27303
public void shouldRemoveSemicolonContentWithReadOnlyInstance() {
assertThatCode(UrlPathHelper.defaultInstance::shouldRemoveSemicolonContent).doesNotThrowAnyException();
}


//
// suite of tests root requests for default servlets (SRV 11.2) on Websphere vs Tomcat and other containers
Expand Down

0 comments on commit 51a1731

Please sign in to comment.