Repository: zeppelin
Updated Branches:
  refs/heads/master afd2bca46 -> 13f6dc7de


[Bug Fix] fix exceptions in jdbc interpreter

### What is this PR for?
Now used class Throwables to convert stack trace into String. This class from 
guava which is dependency of hadoop-common. hadoop-common is **provided**. 
Throwables changed to ExceptionsUtils (from commons-lang), commons-lang there 
is in **zeppelin-interpreter**.

### What type of PR is it?
[Bug Fix]

### How should this be tested?
Run incorrect query

### Screenshots (if appropriate)
before
![2017-10-26 
10-21-26](https://user-images.githubusercontent.com/25951039/32036385-f086b498-ba38-11e7-958d-6d76ec1569b6.png)

after
![2017-10-26 
10-24-05](https://user-images.githubusercontent.com/25951039/32036384-f05eb59c-ba38-11e7-9d4a-e6a1ca0897bc.png)

### Questions:
* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? no

Author: tinkoff-dwh <tinkoff....@gmail.com>

Closes #2633 from tinkoff-dwh/jdbc_fix_exceptions and squashes the following 
commits:

42af568 [tinkoff-dwh] [Buf Fix] fix exceptions in jdbc interpreter


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/13f6dc7d
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/13f6dc7d
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/13f6dc7d

Branch: refs/heads/master
Commit: 13f6dc7def5091366e64c08f6c404c97008d9c50
Parents: afd2bca
Author: tinkoff-dwh <tinkoff....@gmail.com>
Authored: Thu Oct 26 10:25:57 2017 +0500
Committer: Jeff Zhang <zjf...@apache.org>
Committed: Thu Nov 2 09:13:44 2017 +0800

----------------------------------------------------------------------
 .../main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java   | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/13f6dc7d/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
----------------------------------------------------------------------
diff --git a/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java 
b/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
index f3dfddc..0265e2d 100644
--- a/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
+++ b/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
@@ -38,6 +38,7 @@ import 
org.apache.commons.dbcp2.DriverManagerConnectionFactory;
 import org.apache.commons.dbcp2.PoolableConnectionFactory;
 import org.apache.commons.dbcp2.PoolingDriver;
 import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.commons.lang.mutable.MutableBoolean;
 import org.apache.commons.pool2.ObjectPool;
 import org.apache.commons.pool2.impl.GenericObjectPool;
@@ -60,8 +61,6 @@ import org.apache.zeppelin.user.UsernamePassword;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Throwables;
-
 import static org.apache.commons.lang.StringUtils.containsIgnoreCase;
 import static org.apache.commons.lang.StringUtils.isEmpty;
 import static org.apache.commons.lang.StringUtils.isNotEmpty;
@@ -679,7 +678,7 @@ public class JDBCInterpreter extends KerberosInterpreter {
     try {
       connection = getConnection(propertyKey, interpreterContext);
     } catch (Exception e) {
-      String errorMsg = Throwables.getStackTraceAsString(e);
+      String errorMsg = ExceptionUtils.getStackTrace(e);
       try {
         closeDBPool(user, propertyKey);
       } catch (SQLException e1) {
@@ -757,7 +756,7 @@ public class JDBCInterpreter extends KerberosInterpreter {
       }
     } catch (Throwable e) {
       logger.error("Cannot run " + sql, e);
-      String errorMsg = Throwables.getStackTraceAsString(e);
+      String errorMsg = ExceptionUtils.getStackTrace(e);
       interpreterResult.add(errorMsg);
       return new InterpreterResult(Code.ERROR, interpreterResult.message());
     } finally {

Reply via email to