You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by bz...@apache.org on 2016/06/15 06:56:57 UTC

zeppelin git commit: Prevent NullPointerException if "gatewayServer" does not exist

Repository: zeppelin
Updated Branches:
  refs/heads/master 5ddc1ef87 -> a4f19148a


Prevent NullPointerException if "gatewayServer" does not exist

### What is this PR for?
Avoiding and preventing undesired NullPointerException during re-loading python interpreter
Since py4j is optional when PythonInterpreter starts, it should be optional too while it close.

### What type of PR is it?
[Improvement]

### What is the Jira issue?
* N/A

### How should this be tested?

Reload PythongInterpreter on Zeppelin web "Interpreter" menu and check the log message if it complains NullPointerException

### 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: Kwon, Yeong-Eon <ha...@gmail.com>
Author: Y.E. Kwon <Ou...@users.noreply.github.com>

Closes #1009 from OutOfBedlam/python and squashes the following commits:

5ed2413 [Y.E. Kwon] Fix code style
ccbf7ef [Kwon, Yeong-Eon] Prevent NullPointerException if "gatewayServer" does not exist


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

Branch: refs/heads/master
Commit: a4f19148aae1398f0d2c18ee4eb0004d8f2a4ac4
Parents: 5ddc1ef
Author: Kwon, Yeong-Eon <ha...@gmail.com>
Authored: Wed Jun 15 08:59:09 2016 +0900
Committer: Alexander Bezzubov <bz...@apache.org>
Committed: Wed Jun 15 15:56:46 2016 +0900

----------------------------------------------------------------------
 .../java/org/apache/zeppelin/python/PythonInterpreter.java   | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a4f19148/python/src/main/java/org/apache/zeppelin/python/PythonInterpreter.java
----------------------------------------------------------------------
diff --git a/python/src/main/java/org/apache/zeppelin/python/PythonInterpreter.java b/python/src/main/java/org/apache/zeppelin/python/PythonInterpreter.java
index 23aeca2..e80548f 100644
--- a/python/src/main/java/org/apache/zeppelin/python/PythonInterpreter.java
+++ b/python/src/main/java/org/apache/zeppelin/python/PythonInterpreter.java
@@ -125,8 +125,12 @@ public class PythonInterpreter extends Interpreter {
 
     logger.info("closing Python interpreter .....");
     try {
-      process.close();
-      gatewayServer.shutdown();
+      if (process != null) {
+        process.close();
+      }
+      if (gatewayServer != null) {
+        gatewayServer.shutdown();
+      }
     } catch (IOException e) {
       logger.error("Can't close the interpreter", e);
     }