if (parameterValue != null && StringUtils.isNotBlank(parameterValue.toString())) {
String json = parameterValue.toString();
String script = matcher.replaceAll("");
if (StringUtils.isBlank(script)) {
throw new DataLoadingException(
String.format("The script doesn't contain json path expression. " +
"Script [%s]", reportQuery.getScript()));
}
try {
Object scriptResult = JsonPath.read(json, script);
parseScriptResult(result, script, scriptResult);
} catch (com.jayway.jsonpath.PathNotFoundException e) {
return Collections.emptyList();
} catch (Throwable e) {
throw new DataLoadingException(
String.format("An error occurred while loading data with script [%s]", reportQuery.getScript()), e);
}
} else {
return Collections.emptyList();
}
} else {
throw new DataLoadingException(String.format("Query string doesn't contain link to parameter. " +
"Script [%s]", reportQuery.getScript()));
}
return result;
}