Repository: zeppelin Updated Branches: refs/heads/branch-0.8 f49bd8c1c -> ec919123a
[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' (cherry picked from commit fe660abb9663173998d6e02504ef3238f869c080) Signed-off-by: Jeff Zhang <zjf...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/ec919123 Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/ec919123 Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/ec919123 Branch: refs/heads/branch-0.8 Commit: ec919123a888c78ca725fe86554e5313662a3c2a Parents: f49bd8c 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:13:19 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/ec919123/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