You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by pd...@apache.org on 2021/06/25 07:30:11 UTC

[zeppelin] branch branch-0.9 updated: [Zeppelin-4765] Fix mongodb interpreter: missing dependency

This is an automated email from the ASF dual-hosted git repository.

pdallig pushed a commit to branch branch-0.9
in repository https://gitbox.apache.org/repos/asf/zeppelin.git


The following commit(s) were added to refs/heads/branch-0.9 by this push:
     new fac3df6  [Zeppelin-4765] Fix mongodb interpreter: missing dependency
fac3df6 is described below

commit fac3df64a1e89b82e77b69aef5b4f332745c7586
Author: Christoph Nölle <19...@users.noreply.github.co>
AuthorDate: Thu Jun 24 01:19:07 2021 +0200

    [Zeppelin-4765] Fix mongodb interpreter: missing dependency
    
    ### What is this PR for?
    Adds a missing dependency for the mongodb interpreter.
    
    ### What type of PR is it?
    Bug Fix
    
    ### Todos
    
    ### What is the Jira issue?
    https://issues.apache.org/jira/browse/ZEPPELIN-4765
    
    ### How should this be tested?
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Author: Christoph Nölle <19...@users.noreply.github.co>
    Author: cnoelle <19...@users.noreply.github.com>
    
    Closes #4151 from cnoelle/ZEPPELIN-4765 and squashes the following commits:
    
    0087d62eb [cnoelle] Merge branch 'apache:master' into ZEPPELIN-4765
    e8da449d0 [Christoph Nölle] mongodb interpreter: add missing dependency lang3
    
    (cherry picked from commit 5aa9d16b5d20a81204aee779c8de2564a077df06)
    Signed-off-by: Philipp Dallig <ph...@gmail.com>
---
 mongodb/pom.xml                                                |  4 ++++
 .../java/org/apache/zeppelin/mongodb/MongoDbInterpreter.java   | 10 ++++------
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/mongodb/pom.xml b/mongodb/pom.xml
index 95c31cc..de20dad 100644
--- a/mongodb/pom.xml
+++ b/mongodb/pom.xml
@@ -42,6 +42,10 @@
         <groupId>commons-io</groupId>
         <artifactId>commons-io</artifactId>
       </dependency>
+      <dependency>
+        <groupId>org.apache.commons</groupId>
+        <artifactId>commons-lang3</artifactId>
+      </dependency>
     </dependencies>
 
     <build>
diff --git a/mongodb/src/main/java/org/apache/zeppelin/mongodb/MongoDbInterpreter.java b/mongodb/src/main/java/org/apache/zeppelin/mongodb/MongoDbInterpreter.java
index b812b68..990909a 100644
--- a/mongodb/src/main/java/org/apache/zeppelin/mongodb/MongoDbInterpreter.java
+++ b/mongodb/src/main/java/org/apache/zeppelin/mongodb/MongoDbInterpreter.java
@@ -67,14 +67,13 @@ public class MongoDbInterpreter extends Interpreter {
 
   @Override
   public void open() {
-    shellExtension = new Scanner(MongoDbInterpreter.class.getResourceAsStream("/shell_extension.js"), "UTF-8")
-            .useDelimiter("\\A").next();
-
+    try (final Scanner scanner = new Scanner(MongoDbInterpreter.class.getResourceAsStream("/shell_extension.js"),
+            "UTF-8").useDelimiter("\\A")) {
+        shellExtension = scanner.next();
+    }
     commandTimeout = Long.parseLong(getProperty("mongo.shell.command.timeout"));
     maxConcurrency = Integer.parseInt(getProperty("mongo.interpreter.concurrency.max"));
-
     dbAddress = getProperty("mongo.server.host") + ":" + getProperty("mongo.server.port");
-
     prepareShellExtension();
   }
 
@@ -150,7 +149,6 @@ public class MongoDbInterpreter extends Interpreter {
       FileUtils.deleteQuietly(scriptFile);
       stopProcess(paragraphId);
     }
-
     return result;
   }