From commits-return-21146-archive-asf-public=cust-asf.ponee.io@phoenix.apache.org Wed May 9 23:09:46 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 5CC49180649 for ; Wed, 9 May 2018 23:09:46 +0200 (CEST) Received: (qmail 62662 invoked by uid 500); 9 May 2018 21:09:45 -0000 Mailing-List: contact commits-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list commits@phoenix.apache.org Received: (qmail 62653 invoked by uid 99); 9 May 2018 21:09:45 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2018 21:09:45 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 04334DFAE3; Wed, 9 May 2018 21:09:45 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ankit@apache.org To: commits@phoenix.apache.org Message-Id: <8d53d3cd61fa4785be08629ce687ae8b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: phoenix git commit: NPE while running sql through file using psql Date: Wed, 9 May 2018 21:09:45 +0000 (UTC) Repository: phoenix Updated Branches: refs/heads/5.x-HBase-2.0 ff0b8089d -> a83afc4a6 NPE while running sql through file using psql Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/a83afc4a Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/a83afc4a Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/a83afc4a Branch: refs/heads/5.x-HBase-2.0 Commit: a83afc4a6dc1500400890c263ceaae896fe04f55 Parents: ff0b808 Author: Ankit Singhal Authored: Wed May 9 13:52:31 2018 -0700 Committer: Ankit Singhal Committed: Wed May 9 13:52:31 2018 -0700 ---------------------------------------------------------------------- .../org/apache/phoenix/log/QueryLoggerUtil.java | 24 ++++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/a83afc4a/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 2f22931..d5c4878 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,10 +30,14 @@ 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 bindParameters) { - queryLogger.log(QueryLogState.STARTED, - getInitialDetails(tenantId, queryServices, query, startTime, bindParameters)); + public static void logInitialDetails(QueryLogger queryLogger, PName tenantId, ConnectionQueryServices queryServices, + String query, long startTime, List bindParameters) { + try { + queryLogger.log(QueryLogState.STARTED, + getInitialDetails(tenantId, queryServices, query, startTime, bindParameters)); + } catch (Exception e) { + // Ignore for now + } } @@ -46,15 +50,21 @@ public class QueryLoggerUtil { } catch (UnknownHostException e) { clientIP = "UnknownHost"; } - queryLogBuilder.put(QueryLogInfo.CLIENT_IP_I, clientIP); - queryLogBuilder.put(QueryLogInfo.QUERY_I, query); + + if (clientIP != null) { + queryLogBuilder.put(QueryLogInfo.CLIENT_IP_I, clientIP); + } + if (query != null) { + 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();