11package io .github .delirius325 .jmeter .backendlistener .elasticsearch ;
22
3- import javafx .util .StringConverter ;
43import org .apache .jmeter .assertions .AssertionResult ;
54import org .apache .jmeter .samplers .SampleResult ;
65import org .apache .jmeter .threads .JMeterContextService ;
@@ -23,17 +22,6 @@ public class ElasticSearchMetric {
2322 private String esTimestamp ;
2423 private int ciBuildNumber ;
2524 private HashMap <String , Object > json ;
26- private StringConverter <Long > stringConvert = new StringConverter <Long >() {
27- @ Override
28- public String toString (Long object ) {
29- return String .valueOf (object );
30- }
31-
32- @ Override
33- public Long fromString (String string ) {
34- return Long .parseLong (string );
35- }
36- };
3725
3826 public ElasticSearchMetric (SampleResult sr , String testMode , String timeStamp , int buildNumber ) {
3927 this .sampleResult = sr ;
@@ -154,7 +142,7 @@ private void addCustomFields(BackendListenerContext context) {
154142 String parameter = context .getParameter (parameterName ).trim ();
155143
156144 try {
157- this .json .put (parameterName , stringConvert . fromString (parameter ));
145+ this .json .put (parameterName , Long . parseLong (parameter ));
158146 } catch (Exception e ) {
159147 if (logger .isDebugEnabled ())
160148 logger .debug ("Cannot convert custom field to number" );
0 commit comments