use of org.pentaho.di.trans.steps.jsoninput.exception.JsonInputException in project pentaho-kettle by pentaho.
the class FastJsonReader method evalCombinedResult.
private List<List<?>> evalCombinedResult() throws JsonInputException {
int lastSize = -1;
String prevPath = null;
List<List<?>> results = new ArrayList<>(compiledJsonPaths.length);
int i = 0;
for (JsonPath path : compiledJsonPaths) {
List<Object> result = getReadContext().read(path);
if (result.size() != lastSize && lastSize > 0 && !result.isEmpty()) {
throw new JsonInputException(BaseMessages.getString(PKG, "JsonInput.Error.BadStructure", result.size(), inputFields[i].getPath(), prevPath, lastSize));
}
if (!isIgnoreMissingPath() && (isAllNull(result) || result.isEmpty())) {
throw new JsonInputException(BaseMessages.getString(PKG, "JsonReader.Error.CanNotFindPath", inputFields[i].getPath()));
}
results.add(result);
lastSize = result.size();
prevPath = inputFields[i].getPath();
i++;
}
return results;
}
use of org.pentaho.di.trans.steps.jsoninput.exception.JsonInputException in project pentaho-kettle by pentaho.
the class JsonInput method parseNextInputToRowSet.
private void parseNextInputToRowSet(InputStream input) throws KettleException {
try {
data.readerRowSet = data.reader.parse(input);
input.close();
} catch (KettleException ke) {
logInputError(ke);
throw new JsonInputException(ke);
} catch (Exception e) {
logInputError(e);
throw new JsonInputException(e);
}
}
Aggregations