jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [jmeter] ham1 commented on a change in pull request #645: Add escaping for new lines in AbstractInfluxdbMetricsSender
Date Thu, 25 Feb 2021 18:47:57 GMT

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



Mime
View raw message