From 92a55df8e629751b5a93f974e9e923b1732117fc Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Fri, 29 Dec 2017 14:44:09 -0500 Subject: [PATCH] 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@72f1f98f656d86def6902e8fa480668b3462bb8a --- .../sql/analysis/analyzer/VerificationException.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sql/server/src/main/java/org/elasticsearch/xpack/sql/analysis/analyzer/VerificationException.java b/sql/server/src/main/java/org/elasticsearch/xpack/sql/analysis/analyzer/VerificationException.java index 5ee06f51060..86af4815894 100644 --- a/sql/server/src/main/java/org/elasticsearch/xpack/sql/analysis/analyzer/VerificationException.java +++ b/sql/server/src/main/java/org/elasticsearch/xpack/sql/analysis/analyzer/VerificationException.java @@ -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 failures; + private final Collection failures; protected VerificationException(Collection 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)); } }