Repository: zeppelin
Updated Branches:
  refs/heads/master a29fe1473 -> 41c74f59a


[HOTFIX] NPE when there's no properties field in interpreter-setting.json

### What is this PR for?
Fixing NPE while initializing interpreters from interpreter-setting.json

### What type of PR is it?
[Bug Fix | Hot Fix]

### Todos
* [x] - Fix NPE

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

### How should this be tested?
1. delete `properties` in one of `interpreter-setting.json`
1. Build and run
1. Got error
1. Apply this PR
1. Build and run
1. Run it successfully

### 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: Jongyoul Lee <[email protected]>

Closes #1128 from jongyoul/hotfix/interpreter-properties-is-null and squashes 
the following commits:

1dcf562 [Jongyoul Lee] Fixed NPE when there's no properties field in 
interpreter-setting.json


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

Branch: refs/heads/master
Commit: 41c74f59a25bcf0bb5bceac2fad4c723db2165f4
Parents: a29fe14
Author: Jongyoul Lee <[email protected]>
Authored: Tue Jul 5 12:49:22 2016 +0900
Committer: Jongyoul Lee <[email protected]>
Committed: Tue Jul 5 14:28:59 2016 +0900

----------------------------------------------------------------------
 .../zeppelin/interpreter/InterpreterFactory.java      | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/41c74f59/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java
 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java
index 47a4325..a691628 100644
--- 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java
+++ 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java
@@ -212,8 +212,11 @@ public class InterpreterFactory implements 
InterpreterGroupFactory {
           if (null != infos) {
             Properties p = new Properties();
             for (RegisteredInterpreter info : infos) {
-              for (String key : info.getProperties().keySet()) {
-                p.put(key, info.getProperties().get(key).getValue());
+              Map<String, InterpreterProperty> interpreterProperties = 
info.getProperties();
+              if (null != interpreterProperties) {
+                for (String key : info.getProperties().keySet()) {
+                  p.put(key, info.getProperties().get(key).getValue());
+                }
               }
             }
             add(groupName, groupName, new LinkedList<Dependency>(), 
defaultOption, p);
@@ -224,8 +227,11 @@ public class InterpreterFactory implements 
InterpreterGroupFactory {
           List<RegisteredInterpreter> infos = groupClassNameMap.get(groupName);
           Properties p = new Properties();
           for (RegisteredInterpreter info : infos) {
-            for (String key : info.getProperties().keySet()) {
-              p.put(key, info.getProperties().get(key).getValue());
+            Map<String, InterpreterProperty> interpreterProperties = 
info.getProperties();
+            if (null != interpreterProperties) {
+              for (String key : info.getProperties().keySet()) {
+                p.put(key, info.getProperties().get(key).getValue());
+              }
             }
           }
           add(groupName, groupName, new LinkedList<Dependency>(), 
defaultOption, p);

Reply via email to