mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[jsonpath] Fix exception when input string is empty (#15283)
Signed-off-by: Jan N. Klug <github@klug.nrw>
This commit is contained in:
parent
36741bf004
commit
4afe151108
@ -59,6 +59,10 @@ public class JSonPathTransformationService implements TransformationService {
|
||||
|
||||
logger.debug("about to transform '{}' by the function '{}'", source, jsonPathExpression);
|
||||
|
||||
if (source.isBlank()) {
|
||||
// return null if source is empty/blank, JSONPath will throw an IAE on empty input strings
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
Object transformationResult = JsonPath.read(source, jsonPathExpression);
|
||||
logger.debug("transformation resulted in '{}'", transformationResult);
|
||||
|
Loading…
Reference in New Issue
Block a user