SQL: Fix checkstyle in VerificationException (elastic/x-pack-elasticsearch#3447)

Rewrite a very long line into a few shorter lines.

Original commit: elastic/x-pack-elasticsearch@72f1f98f65
This commit is contained in:
Nik Everett 2017-12-29 14:44:09 -05:00 committed by GitHub
parent 5c7395f7fc
commit 92a55df8e6
1 changed files with 7 additions and 5 deletions

View File

@ -6,28 +6,30 @@
package org.elasticsearch.xpack.sql.analysis.analyzer;
import java.util.Collection;
import java.util.Locale;
import java.util.stream.Collectors;
import org.elasticsearch.xpack.sql.analysis.AnalysisException;
import org.elasticsearch.xpack.sql.analysis.analyzer.Verifier.Failure;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.util.StringUtils;
import static java.lang.String.format;
public class VerificationException extends AnalysisException {
private final Collection<Failure> failures;
private final Collection<Failure> failures;
protected VerificationException(Collection<Failure> sources) {
super(null, StringUtils.EMPTY);
failures = sources;
}
@Override
public String getMessage() {
return failures.stream()
.map(f -> format(Locale.ROOT, "line %s:%s: %s", f.source().location().getLineNumber(), f.source().location().getColumnNumber(), f.message()))
.map(f -> {
Location l = f.source().location();
return "line " + l.getLineNumber() + ":" + l.getColumnNumber() + ": " + f.message();
})
.collect(Collectors.joining(StringUtils.NEW_LINE, "Found " + failures.size() + " problem(s)\n", StringUtils.EMPTY));
}
}