You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2022/10/25 16:44:29 UTC

[GitHub] [solr] dsmiley commented on a diff in pull request #1122: SOLR-16476: Remove commons-text dependency from solr-core

dsmiley commented on code in PR #1122:
URL: https://github.com/apache/solr/pull/1122#discussion_r1004722804


##########
solr/core/src/java/org/apache/solr/servlet/LoadAdminUiServlet.java:
##########
@@ -70,20 +67,13 @@ public void doGet(HttpServletRequest _request, HttpServletResponse _response) th
         // We have to close this to flush OutputStreamWriter buffer
         out =
             new OutputStreamWriter(
-                new CloseShieldOutputStream(response.getOutputStream()), StandardCharsets.UTF_8);
+                CloseShieldOutputStream.wrap(response.getOutputStream()), StandardCharsets.UTF_8);
 
-        String html = IOUtils.toString(in, "UTF-8");
         Package pack = SolrCore.class.getPackage();
-
-        String[] search = new String[] {"${contextPath}", "${adminPath}", "${version}"};
-        String[] replace =
-            new String[] {
-              StringEscapeUtils.escapeEcmaScript(request.getContextPath()),
-              StringEscapeUtils.escapeEcmaScript(CommonParams.CORES_HANDLER_PATH),
-              StringEscapeUtils.escapeEcmaScript(pack.getSpecificationVersion())
-            };
-
-        out.write(StringUtils.replaceEach(html, search, replace));
+        String html =
+            IOUtils.toString(in, StandardCharsets.UTF_8)
+                .replace("${version}", pack.getSpecificationVersion());
+        out.write(html);

Review Comment:
   Very thorough of you -- much appreciated!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org