Skip to content

Commit

Permalink
[ZEPPELIN-3243] fix IndexOutOfBoundsException when 'No interpreter is…
Browse files Browse the repository at this point in the history
… 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.weise@avm.de>

Closes apache#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'
  • Loading branch information
weand authored and zjffdu committed Mar 6, 2018
1 parent e148c8c commit fe660ab
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -412,7 +412,8 @@ private void registerInterpreterSetting(List<RegisteredInterpreter> registeredIn

@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) {
Expand Down Expand Up @@ -468,7 +469,7 @@ public Map<String, Object> getEditorSetting(Interpreter interpreter, String user
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
Expand Down

0 comments on commit fe660ab

Please sign in to comment.