You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by li...@apache.org on 2019/06/02 14:53:09 UTC

[zeppelin] branch master updated: [ZEPPELIN-4102] fix "getJSONObject()" to "optJSONObject()" to avoid crash

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

liuxun 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 7533db5  [ZEPPELIN-4102] fix "getJSONObject()" to "optJSONObject()" to avoid crash
7533db5 is described below

commit 7533db583b12e3e87c4500efedaa561a8a2c4383
Author: bd2019us <bd...@126.com>
AuthorDate: Sun Mar 31 15:51:38 2019 -0500

    [ZEPPELIN-4102] fix "getJSONObject()" to "optJSONObject()" to avoid crash
    
    ### What is this PR for?
    Fix [#ZEPPELIN-4102](https://issues.apache.org/jira/browse/ZEPPELIN-4102), which changes "getJSONObject()" to "optJSONObject()" to avoid program crash.
    
    ### What type of PR is it?
    [Bug Fix]
    
    Author: bd2019us <bd...@126.com>
    
    Closes #3344 from bd2019us/ZEPPELIN-4102-PATCH and squashes the following commits:
    
    a205e68c3 [bd2019us] [ZEPPELIN-4102] fix bug to avoid crash
---
 .../java/org/apache/zeppelin/elasticsearch/client/HttpBasedClient.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/elasticsearch/src/main/java/org/apache/zeppelin/elasticsearch/client/HttpBasedClient.java b/elasticsearch/src/main/java/org/apache/zeppelin/elasticsearch/client/HttpBasedClient.java
index f2a9f02..9452816 100644
--- a/elasticsearch/src/main/java/org/apache/zeppelin/elasticsearch/client/HttpBasedClient.java
+++ b/elasticsearch/src/main/java/org/apache/zeppelin/elasticsearch/client/HttpBasedClient.java
@@ -74,7 +74,7 @@ public class HttpBasedClient implements ElasticsearchClient {
   private JSONObject getParentField(JSONObject parent, String[] fields) {
     JSONObject obj = parent;
     for (int i = 0; i < fields.length - 1; i++) {
-      obj = obj.getJSONObject(fields[i]);
+      obj = obj.optJSONObject(fields[i]);
     }
     return obj;
   }