File tree Expand file tree Collapse file tree 1 file changed +3
-24
lines changed
src/main/java/io/github/delirius325/jmeter/backendlistener/elasticsearch Expand file tree Collapse file tree 1 file changed +3
-24
lines changed Original file line number Diff line number Diff line change 20
20
import org .slf4j .Logger ;
21
21
import org .slf4j .LoggerFactory ;
22
22
23
+ import static org .apache .commons .lang .math .NumberUtils .isNumber ;
24
+
23
25
public class ElasticSearchMetric {
24
26
private static final Logger logger = LoggerFactory .getLogger (ElasticSearchMetric .class );
25
27
private SampleResult sampleResult ;
@@ -162,7 +164,7 @@ private void addCustomFields(BackendListenerContext context) {
162
164
163
165
if (!parameterName .startsWith ("es." ) && context .containsParameter (parameterName )
164
166
&& !"" .equals (parameter = context .getParameter (parameterName ).trim ())) {
165
- if (isInteger (parameter )) {
167
+ if (isNumber (parameter )) {
166
168
addFilteredJSON (parameterName , Long .parseLong (parameter ));
167
169
} else {
168
170
addFilteredJSON (parameterName , parameter );
@@ -280,27 +282,4 @@ public Date getElapsedTime(boolean forBuildComparison) {
280
282
}
281
283
}
282
284
283
- private static boolean isInteger (String str ) {
284
- if (str == null ) {
285
- return false ;
286
- }
287
- int length = str .length ();
288
- if (length == 0 ) {
289
- return false ;
290
- }
291
- int i = 0 ;
292
- if (str .charAt (0 ) == '-' ) {
293
- if (length == 1 ) {
294
- return false ;
295
- }
296
- i = 1 ;
297
- }
298
- for (; i < length ; i ++) {
299
- char c = str .charAt (i );
300
- if (c < '0' || c > '9' ) {
301
- return false ;
302
- }
303
- }
304
- return true ;
305
- }
306
285
}
You can’t perform that action at this time.
0 commit comments