You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by zj...@apache.org on 2021/07/09 02:18:47 UTC

[zeppelin] branch branch-0.9 updated: [ZEPPELIN-5436] NPE in ZeppelinClient

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

zjffdu 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 64a3621  [ZEPPELIN-5436] NPE in ZeppelinClient
64a3621 is described below

commit 64a36216e044d9ce79df253527c7913d08ab81e7
Author: Jeff Zhang <zj...@apache.org>
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 <zj...@apache.org>
    
    Closes #4167 from zjffdu/ZEPPELIN-5436 and squashes the following commits:
    
    100e66ae9f [Jeff Zhang] [ZEPPELIN-5436] NPE in ZeppelinClient
    
    (cherry picked from commit 593a5ccdb36b198eacbd89ec24dd2537b0f2b0ca)
    Signed-off-by: Jeff Zhang <zj...@apache.org>
---
 .../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",