Am 20.10.2016 16:01, schrieb Roberto Braga:
I think there is a bug in the file

apache-jmeter-3.0-src/src/components/org/apache/jmeter/extractor/json/jsonpath/JSONPostProcessor.java


at line 163, there is the else where i goes if only one match

The below src code is not in sync with the current code.

But I think the important step for you is to place an additional var with 'name_1' into vars in the case, when only one element is found and -1 is used to indicate, that all elements are wanted. If you want to update your patch you could have a look at the current trunk and use the function stringify(Object).

Regards,
 Felix


} else {

    // else just one value extracted

    Object obj = extractedValues.get(0);

    String objAsString =

            obj != null ? obj.toString() : ""; //$NON-NLS-1$

*     vars.put(currentRefName, *

*             objAsString); *

*     if (matchNumber < 0 && getComputeConcatenation()) {*

*         vars.put(currentRefName + ALL_SUFFIX, objAsString);*

*     }*

}


The part which set the vars  is worng it should be like the following:

} else {

    // else just one value extracted

    Object obj = extractedValues.get(0);

    String objAsString =

            obj != null ? obj.toString() : ""; //$NON-NLS-1$

*     if (matchNumber < 0 && getComputeConcatenation()) {*

*         vars.put(currentRefName + "_1", *

*                 objAsString);*

*         vars.put(currentRefName + ALL_SUFFIX, objAsString);*

*     } else {*

*         vars.put(currentRefName, *

*                 objAsString);*

*     }*

}


In this way it respect the matchNumber docs specification even if only
one value is extracted.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to