Repository: zeppelin
Updated Branches:
  refs/heads/master e148c8cff -> fe660abb9


[ZEPPELIN-3243] fix IndexOutOfBoundsException when 'No interpreter is binded to 
this note'

### What is this PR for?
I observed IndexOutOfBoundsException when using zeppelin locally on an existing 
notebook repository and with fresh interpreter.json file.
The default Zeppelin behavior when using existing notebooks is the manual 
binding of the interpreter settings, which works fine. This PR simply avoids 
the IndexOutOfBoundsException.

### What type of PR is it?
Bug Fix

### Todos
-

### What is the Jira issue?
[https://issues.apache.org/jira/browse/ZEPPELIN-3243](https://issues.apache.org/jira/browse/ZEPPELIN-3243)

### How should this be tested?
- manual

### 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: Andreas Weise <a.we...@avm.de>

Closes #2808 from weand/ZEPPELIN-3243 and squashes the following commits:

b97a38e [Andreas Weise] ZEPPELIN-3243 fix IndexOutOfBoundsException when 'No 
interpreter is binded to this note'


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

Branch: refs/heads/master
Commit: fe660abb9663173998d6e02504ef3238f869c080
Parents: e148c8c
Author: Andreas Weise <a.we...@avm.de>
Authored: Sun Feb 18 12:55:32 2018 +0100
Committer: Jeff Zhang <zjf...@apache.org>
Committed: Tue Mar 6 10:11:35 2018 +0800

----------------------------------------------------------------------
 .../apache/zeppelin/interpreter/InterpreterSettingManager.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fe660abb/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java
 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java
index 711812e..c3ec81b 100644
--- 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java
+++ 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java
@@ -412,7 +412,8 @@ public class InterpreterSettingManager {
 
   @VisibleForTesting
   public InterpreterSetting getDefaultInterpreterSetting(String noteId) {
-    return getInterpreterSettings(noteId).get(0);
+    List<InterpreterSetting> allInterpreterSettings = 
getInterpreterSettings(noteId);
+    return allInterpreterSettings.size() > 0 ? allInterpreterSettings.get(0) : 
null;
   }
 
   public List<InterpreterSetting> getInterpreterSettings(String noteId) {
@@ -468,7 +469,7 @@ public class InterpreterSettingManager {
           group = replNameSplit[0];
         }
         // when replName is 'name' of interpreter
-        if (defaultSettingName.equals(intpSetting.getName())) {
+        if (intpSetting.getName().equals(defaultSettingName)) {
           editor = 
intpSetting.getEditorFromSettingByClassName(interpreter.getClassName());
         }
         // when replName is 'alias name' of interpreter or 'group' of 
interpreter

Reply via email to