Skip to content

Commit 10a90d3

Browse files
evpaassensbrannen
authored andcommitted
Fix UrlPathHelper#shouldRemoveSemicolonContent() (#27303)
The checkReadOnly() method should only be called from methods that modify properties to prevent modification of read-only instances. Fixes #27256
1 parent ab2a861 commit 10a90d3

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
@@ -132,7 +132,6 @@ public void setRemoveSemicolonContent(boolean removeSemicolonContent) {
132132
* Whether configured to remove ";" (semicolon) content from the request URI.
133133
*/
134134
public boolean shouldRemoveSemicolonContent() {
135-
checkReadOnly();
136135
return this.removeSemicolonContent;
137136
}
138137

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
@@ -24,6 +24,7 @@
2424
import org.springframework.web.testfixture.servlet.MockHttpServletRequest;
2525

2626
import static org.assertj.core.api.Assertions.assertThat;
27+
import static org.assertj.core.api.Assertions.assertThatCode;
2728

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

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

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

0 commit comments

Comments
 (0)