Return-Path: X-Original-To: apmail-drill-commits-archive@www.apache.org Delivered-To: apmail-drill-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AEFA010715 for ; Fri, 23 Jan 2015 19:24:57 +0000 (UTC) Received: (qmail 91597 invoked by uid 500); 23 Jan 2015 19:24:57 -0000 Delivered-To: apmail-drill-commits-archive@drill.apache.org Received: (qmail 91567 invoked by uid 500); 23 Jan 2015 19:24:57 -0000 Mailing-List: contact commits-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: commits@drill.apache.org Delivered-To: mailing list commits@drill.apache.org Received: (qmail 91558 invoked by uid 99); 23 Jan 2015 19:24:57 -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; Fri, 23 Jan 2015 19:24:57 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4B0A6E03A8; Fri, 23 Jan 2015 19:24:57 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: adi@apache.org To: commits@drill.apache.org Message-Id: <4bfb6d579e4141cfb25e3885e1c5313d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: drill git commit: DRILL-2049: NoClassDefFoundError: org/apache/commons/lang/StringEscapeUtils in JDBC Driver Date: Fri, 23 Jan 2015 19:24:57 +0000 (UTC) Repository: drill Updated Branches: refs/heads/master caa18fa0a -> 4335c8831 DRILL-2049: NoClassDefFoundError: org/apache/commons/lang/StringEscapeUtils in JDBC Driver + Ban commons-lang v2 classes from being used. Project: http://git-wip-us.apache.org/repos/asf/drill/repo Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/4335c883 Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/4335c883 Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/4335c883 Branch: refs/heads/master Commit: 4335c88318551187a567aa719d41a7b76a3aa315 Parents: caa18fa Author: Aditya Kishore Authored: Tue Jan 20 22:16:34 2015 -0800 Committer: Aditya Kishore Committed: Fri Jan 23 10:57:44 2015 -0800 ---------------------------------------------------------------------- .../drill/common/util/DrillStringUtils.java | 11 ++++++++++ .../apache/drill/exec/record/TypedFieldId.java | 2 +- .../drill/exec/store/dfs/FileSelection.java | 2 +- .../apache/drill/exec/util/BatchPrinter.java | 2 +- .../org/apache/drill/exec/util/VectorUtil.java | 2 +- .../apache/drill/exec/work/foreman/Foreman.java | 2 +- .../java/org/apache/drill/jdbc/MetaImpl.java | 22 ++++++++++---------- src/main/resources/checkstyle-config.xml | 3 ++- 8 files changed, 29 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/drill/blob/4335c883/common/src/main/java/org/apache/drill/common/util/DrillStringUtils.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/drill/common/util/DrillStringUtils.java b/common/src/main/java/org/apache/drill/common/util/DrillStringUtils.java index 63538d9..83bfdc1 100644 --- a/common/src/main/java/org/apache/drill/common/util/DrillStringUtils.java +++ b/common/src/main/java/org/apache/drill/common/util/DrillStringUtils.java @@ -20,6 +20,7 @@ package org.apache.drill.common.util; import io.netty.buffer.ByteBuf; import org.apache.commons.lang3.StringEscapeUtils; +import org.apache.commons.lang3.StringUtils; public class DrillStringUtils { @@ -95,6 +96,16 @@ public class DrillStringUtils { } /** + * Copied form commons-lang 2.x code as common-lang 3.x has this API removed. + * (http://commons.apache.org/proper/commons-lang/article3_0.html#StringEscapeUtils.escapeSql) + * @param str + * @return + */ + public static String escapeSql(String str) { + return (str == null) ? null : StringUtils.replace(str, "'", "''"); + } + + /** * Return a printable representation of a byte buffer, escaping the non-printable * bytes as '\\xNN' where NN is the hexadecimal representation of such bytes. * http://git-wip-us.apache.org/repos/asf/drill/blob/4335c883/exec/java-exec/src/main/java/org/apache/drill/exec/record/TypedFieldId.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/TypedFieldId.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/TypedFieldId.java index f7cfefa..db8bfa8 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/TypedFieldId.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/TypedFieldId.java @@ -19,7 +19,7 @@ package org.apache.drill.exec.record; import java.util.Arrays; -import org.apache.commons.lang.ArrayUtils; +import org.apache.commons.lang3.ArrayUtils; import org.apache.drill.common.expression.PathSegment; import org.apache.drill.common.types.TypeProtos.MajorType; import org.apache.drill.exec.expr.TypeHelper; http://git-wip-us.apache.org/repos/asf/drill/blob/4335c883/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSelection.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSelection.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSelection.java index edf5dbc..cf8937f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSelection.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSelection.java @@ -21,7 +21,7 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import org.apache.commons.lang.ArrayUtils; +import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.apache.drill.exec.store.dfs.shim.DrillFileSystem; import org.apache.hadoop.fs.FileStatus; http://git-wip-us.apache.org/repos/asf/drill/blob/4335c883/exec/java-exec/src/main/java/org/apache/drill/exec/util/BatchPrinter.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/util/BatchPrinter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/util/BatchPrinter.java index 1029e61..6021cd2 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/util/BatchPrinter.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/util/BatchPrinter.java @@ -19,7 +19,7 @@ package org.apache.drill.exec.util; import java.util.List; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.drill.exec.record.VectorAccessible; import org.apache.drill.exec.record.VectorWrapper; import org.apache.drill.exec.record.selection.SelectionVector4; http://git-wip-us.apache.org/repos/asf/drill/blob/4335c883/exec/java-exec/src/main/java/org/apache/drill/exec/util/VectorUtil.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/util/VectorUtil.java b/exec/java-exec/src/main/java/org/apache/drill/exec/util/VectorUtil.java index 9919de1..cd1d79b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/util/VectorUtil.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/util/VectorUtil.java @@ -19,7 +19,7 @@ package org.apache.drill.exec.util; import java.util.List; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.drill.common.util.DrillStringUtils; import org.apache.drill.exec.record.MaterializedField; import org.apache.drill.exec.record.VectorAccessible; http://git-wip-us.apache.org/repos/asf/drill/blob/4335c883/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java index fcf5b91..b33042b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java @@ -28,7 +28,7 @@ import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.apache.commons.lang.exception.ExceptionUtils; +import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.drill.common.config.DrillConfig; import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.common.logical.LogicalPlan; http://git-wip-us.apache.org/repos/asf/drill/blob/4335c883/exec/jdbc/src/main/java/org/apache/drill/jdbc/MetaImpl.java ---------------------------------------------------------------------- diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/MetaImpl.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/MetaImpl.java index 904c078..0ea8d5c 100644 --- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/MetaImpl.java +++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/MetaImpl.java @@ -27,8 +27,8 @@ import net.hydromatic.avatica.AvaticaStatement; import net.hydromatic.avatica.Cursor; import net.hydromatic.avatica.Meta; -import org.apache.commons.lang.StringEscapeUtils; import org.apache.drill.common.exceptions.DrillRuntimeException; +import org.apache.drill.common.util.DrillStringUtils; public class MetaImpl implements Meta { @@ -97,15 +97,15 @@ public class MetaImpl implements Meta { + "FROM INFORMATION_SCHEMA.`TABLES` WHERE 1=1 "); if (catalog != null) { - sb.append(" AND TABLE_CATALOG = '" + StringEscapeUtils.escapeSql(catalog) + "' "); + sb.append(" AND TABLE_CATALOG = '" + DrillStringUtils.escapeSql(catalog) + "' "); } if (schemaPattern.s != null) { - sb.append(" AND TABLE_SCHEMA like '" + StringEscapeUtils.escapeSql(schemaPattern.s) + "'"); + sb.append(" AND TABLE_SCHEMA like '" + DrillStringUtils.escapeSql(schemaPattern.s) + "'"); } if (tableNamePattern.s != null) { - sb.append(" AND TABLE_NAME like '" + StringEscapeUtils.escapeSql(tableNamePattern.s) + "'"); + sb.append(" AND TABLE_NAME like '" + DrillStringUtils.escapeSql(tableNamePattern.s) + "'"); } if (typeList != null && typeList.size() > 0) { @@ -114,7 +114,7 @@ public class MetaImpl implements Meta { if (t != 0) { sb.append(" OR "); } - sb.append(" TABLE_TYPE LIKE '" + StringEscapeUtils.escapeSql(typeList.get(t)) + "' "); + sb.append(" TABLE_TYPE LIKE '" + DrillStringUtils.escapeSql(typeList.get(t)) + "' "); } sb.append(")"); } @@ -155,18 +155,18 @@ public class MetaImpl implements Meta { + "WHERE 1=1 "); if (catalog != null) { - sb.append(" AND TABLE_CATALOG = '" + StringEscapeUtils.escapeSql(catalog) + "' "); + sb.append(" AND TABLE_CATALOG = '" + DrillStringUtils.escapeSql(catalog) + "' "); } if (schemaPattern.s != null) { - sb.append(" AND TABLE_SCHEMA like '" + StringEscapeUtils.escapeSql(schemaPattern.s) + "'"); + sb.append(" AND TABLE_SCHEMA like '" + DrillStringUtils.escapeSql(schemaPattern.s) + "'"); } if (tableNamePattern.s != null) { - sb.append(" AND TABLE_NAME like '" + StringEscapeUtils.escapeSql(tableNamePattern.s) + "'"); + sb.append(" AND TABLE_NAME like '" + DrillStringUtils.escapeSql(tableNamePattern.s) + "'"); } if (columnNamePattern.s != null) { - sb.append(" AND COLUMN_NAME like '" + StringEscapeUtils.escapeSql(columnNamePattern.s) + "'"); + sb.append(" AND COLUMN_NAME like '" + DrillStringUtils.escapeSql(columnNamePattern.s) + "'"); } sb.append(" ORDER BY TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME"); @@ -182,10 +182,10 @@ public class MetaImpl implements Meta { + " FROM INFORMATION_SCHEMA.SCHEMATA WHERE 1=1 "); if (catalog != null) { - sb.append(" AND CATALOG_NAME = '" + StringEscapeUtils.escapeSql(catalog) + "' "); + sb.append(" AND CATALOG_NAME = '" + DrillStringUtils.escapeSql(catalog) + "' "); } if (schemaPattern.s != null) { - sb.append(" AND SCHEMA_NAME like '" + StringEscapeUtils.escapeSql(schemaPattern.s) + "'"); + sb.append(" AND SCHEMA_NAME like '" + DrillStringUtils.escapeSql(schemaPattern.s) + "'"); } sb.append(" ORDER BY CATALOG_NAME, SCHEMA_NAME"); http://git-wip-us.apache.org/repos/asf/drill/blob/4335c883/src/main/resources/checkstyle-config.xml ---------------------------------------------------------------------- diff --git a/src/main/resources/checkstyle-config.xml b/src/main/resources/checkstyle-config.xml index 604698f..0758908 100644 --- a/src/main/resources/checkstyle-config.xml +++ b/src/main/resources/checkstyle-config.xml @@ -20,7 +20,8 @@ - + +