Repository: phoenix Updated Branches: refs/heads/5.x-HBase-2.0 a83afc4a6 -> d9308c56b
Revert "NPE while running sql through file using psql" Needs a JIRA number This reverts commit a83afc4a6dc1500400890c263ceaae896fe04f55. Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/0a554fcf Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/0a554fcf Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/0a554fcf Branch: refs/heads/5.x-HBase-2.0 Commit: 0a554fcfb6a181f681a1d9d3c221b4d1f62ad850 Parents: a83afc4 Author: Ankit Singhal <ankitsingha...@gmail.com> Authored: Wed May 9 14:15:40 2018 -0700 Committer: Ankit Singhal <ankitsingha...@gmail.com> Committed: Wed May 9 14:15:40 2018 -0700 ---------------------------------------------------------------------- .../org/apache/phoenix/log/QueryLoggerUtil.java | 24 ++++++-------------- 1 file changed, 7 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/0a554fcf/phoenix-core/src/main/java/org/apache/phoenix/log/QueryLoggerUtil.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/log/QueryLoggerUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/log/QueryLoggerUtil.java index d5c4878..2f22931 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/log/QueryLoggerUtil.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/log/QueryLoggerUtil.java @@ -30,14 +30,10 @@ import com.google.common.collect.ImmutableMap.Builder; public class QueryLoggerUtil { - public static void logInitialDetails(QueryLogger queryLogger, PName tenantId, ConnectionQueryServices queryServices, - String query, long startTime, List<Object> bindParameters) { - try { - queryLogger.log(QueryLogState.STARTED, - getInitialDetails(tenantId, queryServices, query, startTime, bindParameters)); - } catch (Exception e) { - // Ignore for now - } + public static void logInitialDetails(QueryLogger queryLogger, PName tenantId, + ConnectionQueryServices queryServices, String query, long startTime, List<Object> bindParameters) { + queryLogger.log(QueryLogState.STARTED, + getInitialDetails(tenantId, queryServices, query, startTime, bindParameters)); } @@ -50,21 +46,15 @@ public class QueryLoggerUtil { } catch (UnknownHostException e) { clientIP = "UnknownHost"; } - - if (clientIP != null) { - queryLogBuilder.put(QueryLogInfo.CLIENT_IP_I, clientIP); - } - if (query != null) { - queryLogBuilder.put(QueryLogInfo.QUERY_I, query); - } + queryLogBuilder.put(QueryLogInfo.CLIENT_IP_I, clientIP); + queryLogBuilder.put(QueryLogInfo.QUERY_I, query); queryLogBuilder.put(QueryLogInfo.START_TIME_I, startTime); if (bindParameters != null) { - queryLogBuilder.put(QueryLogInfo.BIND_PARAMETERS_I, StringUtils.join(bindParameters, ",")); + queryLogBuilder.put(QueryLogInfo.BIND_PARAMETERS_I, StringUtils.join(bindParameters,",")); } if (tenantId != null) { queryLogBuilder.put(QueryLogInfo.TENANT_ID_I, tenantId.getString()); } - queryLogBuilder.put(QueryLogInfo.USER_I, queryServices.getUserName() != null ? queryServices.getUserName() : queryServices.getUser().getShortName()); return queryLogBuilder.build();