mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Use String#replace instead of String#replaceAll where appropriate
Avoid using String#replaceAll when the pattern is not a regular expression. Using java.lang.String#replace(CharSequence, CharSequence) will improve performance. Closes gh-36678 Signed-off-by: shenjianeng <ishenjianeng@qq.com>
This commit is contained in:
+2
-2
@@ -568,8 +568,8 @@ public class ResourceWebHandler implements WebHandler, InitializingBean {
|
||||
|
||||
private String locationToString(List<Resource> locations) {
|
||||
return locations.toString()
|
||||
.replaceAll("class path resource", "classpath")
|
||||
.replaceAll("ServletContext resource", "ServletContext");
|
||||
.replace("class path resource", "classpath")
|
||||
.replace("ServletContext resource", "ServletContext");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -714,8 +714,8 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
|
||||
|
||||
private String locationToString(List<Resource> locations) {
|
||||
return locations.toString()
|
||||
.replaceAll("class path resource", "classpath")
|
||||
.replaceAll("ServletContext resource", "ServletContext");
|
||||
.replace("class path resource", "classpath")
|
||||
.replace("ServletContext resource", "ServletContext");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user