drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject drill git commit: DRILL-2049: NoClassDefFoundError: org/apache/commons/lang/StringEscapeUtils in JDBC Driver
Date Fri, 23 Jan 2015 19:24:57 GMT
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 <adi@apache.org>
Authored: Tue Jan 20 22:16:34 2015 -0800
Committer: Aditya Kishore <adi@apache.org>
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 @@
   <module name="TreeWalker">
 
     <module name="IllegalImport">
-      <property name="illegalPkgs" value="com.google.hive12,com.beust.jcommander.internal,jersey.repackaged"/>
+      <!-- For "org.apache.commons.lang.*" classes use the corresponding class from "org.apache.commons.lang3.*"
-->
+      <property name="illegalPkgs" value="com.google.hive12,com.beust.jcommander.internal,jersey.repackaged,org.apache.commons.lang"/>
     </module>
 
     <module name="AvoidStarImport">


Mime
View raw message