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 593a5cc  [ZEPPELIN-5436] NPE in ZeppelinClient
593a5cc is described below

commit 593a5ccdb36b198eacbd89ec24dd2537b0f2b0ca
Author: Jeff Zhang <[email protected]>
AuthorDate: Wed Jul 7 16:06:45 2021 +0800

    [ZEPPELIN-5436] NPE in ZeppelinClient
    
    ### What is this PR for?
    
    Minor PR to fix NPE in ZeppelinClient
    
    ### What type of PR is it?
    [Improvement ]
    
    ### Todos
    * [ ] - Task
    
    ### What is the Jira issue?
    * https://issues.apache.org/jira/browse/ZEPPELIN-5436
    
    ### 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 <[email protected]>
    
    Closes #4167 from zjffdu/ZEPPELIN-5436 and squashes the following commits:
    
    100e66ae9f [Jeff Zhang] [ZEPPELIN-5436] NPE in ZeppelinClient
---
 .../src/main/java/org/apache/zeppelin/client/ZeppelinClient.java      | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/zeppelin-client/src/main/java/org/apache/zeppelin/client/ZeppelinClient.java 
b/zeppelin-client/src/main/java/org/apache/zeppelin/client/ZeppelinClient.java
index 32553f1..9daec97 100644
--- 
a/zeppelin-client/src/main/java/org/apache/zeppelin/client/ZeppelinClient.java
+++ 
b/zeppelin-client/src/main/java/org/apache/zeppelin/client/ZeppelinClient.java
@@ -88,7 +88,9 @@ public class ZeppelinClient {
     }
     if (response.getStatus() != 200) {
       String message = response.getStatusText();
-      if (response.getBody().getObject().has("message")) {
+      if (response.getBody() != null &&
+              response.getBody().getObject() != null &&
+              response.getBody().getObject().has("message")) {
         message = response.getBody().getObject().getString("message");
       }
       throw new Exception(String.format("Unable to call rest api, status: %s, 
statusText: %s, message: %s",

Reply via email to