Skip to content

Commit 51a1731

Browse files
committed
Fix UrlPathHelper#shouldRemoveSemicolonContent()
The checkReadOnly() method should only be called from methods that modify properties to prevent modification of read-only instances. Fixes #27256
1 parent 9f7a940 commit 51a1731

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

spring-web/src/main/java/org/springframework/web/util/UrlPathHelper.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ public void setRemoveSemicolonContent(boolean removeSemicolonContent) {
147147
* Whether configured to remove ";" (semicolon) content from the request URI.
148148
*/
149149
public boolean shouldRemoveSemicolonContent() {
150-
checkReadOnly();
151150
return this.removeSemicolonContent;
152151
}
153152

spring-web/src/test/java/org/springframework/web/util/UrlPathHelperTests.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.springframework.web.testfixture.servlet.MockHttpServletRequest;
2323

2424
import static org.assertj.core.api.Assertions.assertThat;
25+
import static org.assertj.core.api.Assertions.assertThatCode;
2526

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

169+
@Test // gh-27303
170+
public void shouldRemoveSemicolonContentWithReadOnlyInstance() {
171+
assertThatCode(UrlPathHelper.defaultInstance::shouldRemoveSemicolonContent).doesNotThrowAnyException();
172+
}
173+
168174

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

0 commit comments

Comments
 (0)