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

zjffdu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git


The following commit(s) were added to refs/heads/master by this push:
     new 2608005  [ZEPPELIN-4829] NPE in RemoteInterpreterServer#getStatus when 
interpreter is not opened yet
2608005 is described below

commit 26080055d6fbc5a0e829f47d43d5be7d3135e788
Author: Jeff Zhang <zjf...@apache.org>
AuthorDate: Mon May 25 14:37:30 2020 +0800

    [ZEPPELIN-4829] NPE in RemoteInterpreterServer#getStatus when interpreter 
is not opened yet
    
    ### What is this PR for?
    
    The NPE happens because the scheduler of interpreter is null. This is 
because the interpreter is not opened yet. 
(https://github.com/apache/zeppelin/blob/v0.9.0-preview1/livy/src/main/java/org/apache/zeppelin/livy/LivySparkSQLInterpreter.java#L232)
    
    This PR would check wether interpreter is opened before using its scheduler.
    
    ### What type of PR is it?
    [Bug Fix ]
    
    ### Todos
    * [ ] - Task
    
    ### What is the Jira issue?
    * https://issues.apache.org/jira/browse/ZEPPELIN-4829
    
    ### How should this be tested?
    * CI pass
    
    ### 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: Jeff Zhang <zjf...@apache.org>
    
    Closes #3776 from zjffdu/ZEPPELIN-4829 and squashes the following commits:
    
    1203b7b5c [Jeff Zhang] [ZEPPELIN-4829]. NPE in 
RemoteInterpreterServer#getStatus when interpreter is not opened yet
---
 .../zeppelin/interpreter/remote/RemoteInterpreterServer.java     | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git 
a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java
 
b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java
index 9b9e063..6c4f87d 100644
--- 
a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java
+++ 
b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java
@@ -904,9 +904,12 @@ public class RemoteInterpreterServer extends Thread
       }
 
       for (Interpreter intp : interpreters) {
-        Job job = intp.getScheduler().getJob(jobId);
-        if (job != null) {
-          return job.getStatus().name();
+        Scheduler scheduler = intp.getScheduler();
+        if (scheduler != null) {
+          Job job = scheduler.getJob(jobId);
+          if (job != null) {
+            return job.getStatus().name();
+          }
         }
       }
     }

Reply via email to