use of org.graylog.plugins.views.search.errors.UnboundParameterError in project graylog2-server by Graylog2.
the class QueryValidationServiceImpl method toExplanation.
private List<ValidationMessage> toExplanation(String query, SearchException searchException) {
if (searchException.error() instanceof UnboundParameterError) {
final UnboundParameterError error = (UnboundParameterError) searchException.error();
final List<SubstringMultilinePosition> positions = SubstringMultilinePosition.compute(query, "$" + error.parameterName() + "$");
if (!positions.isEmpty()) {
return positions.stream().map(p -> ValidationMessage.builder().errorType("Parameter error").errorMessage(error.description()).beginLine(p.getLine()).endLine(p.getLine()).beginColumn(p.getBeginColumn()).endColumn(p.getEndColumn()).build()).collect(Collectors.toList());
}
}
return Collections.singletonList(ValidationMessage.fromException(searchException));
}
Aggregations