You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by GitBox <gi...@apache.org> on 2021/02/25 18:47:57 UTC

[GitHub] [jmeter] ham1 commented on a change in pull request #645: Add escaping for new lines in AbstractInfluxdbMetricsSender

ham1 commented on a change in pull request #645:
URL: https://github.com/apache/jmeter/pull/645#discussion_r583080604



##########
File path: src/components/src/main/java/org/apache/jmeter/visualizers/backend/influxdb/AbstractInfluxdbMetricsSender.java
##########
@@ -28,7 +29,11 @@
      * \ to escape List of special characters : commas , equal sign = spaces
      */
     static final String tagToStringValue(String s) {
-        return s.trim().replaceAll(" ", "\\\\ ").replaceAll(",", "\\\\,").replaceAll("=", "\\\\=");
+        return s.trim()
+                .replaceAll(" ", "\\\\ ")
+                .replaceAll(",", "\\\\,")
+                .replaceAll("=", "\\\\=")
+                .replaceAll("\n", "\\\\n");

Review comment:
       This looks ok to me, but while we are here, I believe we should use `replace` as `replaceAll` is only needed when using a regex as the pattern to find (it should also perform better).




----------------------------------------------------------------
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.

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