This is an automated email from the ASF dual-hosted git repository. volodymyr pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/drill.git
commit a66c34dcf33591462be6fdc330178558fb65d483 Author: Paul Rogers <[email protected]> AuthorDate: Mon Mar 9 11:58:28 2020 -0700 DRILL-7632: Improve user exception formatting Adds a colon in the "getMessage()" format of a User Exception between the context name and value: My Context: value closes #2017 --- .../common/exceptions/UserExceptionContext.java | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/common/src/main/java/org/apache/drill/common/exceptions/UserExceptionContext.java b/common/src/main/java/org/apache/drill/common/exceptions/UserExceptionContext.java index 271462a..e49ea4a 100644 --- a/common/src/main/java/org/apache/drill/common/exceptions/UserExceptionContext.java +++ b/common/src/main/java/org/apache/drill/common/exceptions/UserExceptionContext.java @@ -67,7 +67,7 @@ class UserExceptionContext { * @param value context value */ void add(String context, String value) { - add(context + " " + value); + add(deColon(context) + ": " + value); } /** @@ -76,7 +76,7 @@ class UserExceptionContext { * @param value context value */ void add(String context, long value) { - add(context + " " + value); + add(deColon(context) + ": " + value); } /** @@ -85,7 +85,16 @@ class UserExceptionContext { * @param value context value */ void add(String context, double value) { - add(context + " " + value); + add(deColon(context) + ": " + value); + } + + private String deColon(String context) { + context = context.trim(); + if (context.endsWith(":")) { + return context.substring(0, context.length() - 1); + } else { + return context; + } } /** @@ -102,7 +111,7 @@ class UserExceptionContext { * @param value context value */ void push(String context, String value) { - push(context + " " + value); + push(deColon(context) + ": " + value); } /** @@ -111,7 +120,7 @@ class UserExceptionContext { * @param value context value */ void push(String context, long value) { - push(context + " " + value); + push(deColon(context) + ": " + value); } /** @@ -120,7 +129,7 @@ class UserExceptionContext { * @param value context value */ void push(String context, double value) { - push(context + " " + value); + push(deColon(context) + ": " + value); } String getErrorId() {
