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,14 +6,13 @@
package org.elasticsearch.xpack.sql.analysis.analyzer; package org.elasticsearch.xpack.sql.analysis.analyzer;
import java.util.Collection; import java.util.Collection;
import java.util.Locale;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.elasticsearch.xpack.sql.analysis.AnalysisException; import org.elasticsearch.xpack.sql.analysis.AnalysisException;
import org.elasticsearch.xpack.sql.analysis.analyzer.Verifier.Failure; import org.elasticsearch.xpack.sql.analysis.analyzer.Verifier.Failure;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.util.StringUtils; import org.elasticsearch.xpack.sql.util.StringUtils;
import static java.lang.String.format;
public class VerificationException extends AnalysisException { public class VerificationException extends AnalysisException {
@ -27,7 +26,10 @@ public class VerificationException extends AnalysisException {
@Override @Override
public String getMessage() { public String getMessage() {
return failures.stream() 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)); .collect(Collectors.joining(StringUtils.NEW_LINE, "Found " + failures.size() + " problem(s)\n", StringUtils.EMPTY));
} }
} }