mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
fix: mutable object problems in InterpreterSetting
By filling InterpreterSetting object by newly created objects
This commit is contained in:
parent
5460241a38
commit
7825108e77
2 changed files with 8 additions and 5 deletions
|
|
@ -106,7 +106,8 @@ public class InterpreterOption {
|
|||
option.perUser = other.perUser;
|
||||
option.isExistingProcess = other.isExistingProcess;
|
||||
option.setPermission = other.setPermission;
|
||||
option.users = new ArrayList<>(other.users);
|
||||
option.users = (null == other.users) ?
|
||||
new ArrayList<String>() : new ArrayList<>(other.users);
|
||||
|
||||
return option;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -285,14 +285,16 @@ public class InterpreterFactory implements InterpreterGroupFactory {
|
|||
}
|
||||
|
||||
private InterpreterSetting createFromInterpreterSettingRef(InterpreterSetting o) {
|
||||
// return immutable objects
|
||||
List<InterpreterInfo> infos = new ArrayList<>(o.getInterpreterInfos());
|
||||
List<Dependency> deps = new ArrayList<>(o.getDependencies());
|
||||
// should return immutable objects
|
||||
List<InterpreterInfo> infos = (null == o.getInterpreterInfos()) ?
|
||||
new ArrayList<InterpreterInfo>() : new ArrayList<>(o.getInterpreterInfos());
|
||||
List<Dependency> deps = (null == o.getDependencies()) ?
|
||||
new ArrayList<Dependency>() : new ArrayList<>(o.getDependencies());
|
||||
Properties props = convertInterpreterProperties((Map<String, InterpreterProperty>) o.getProperties());
|
||||
InterpreterOption option = InterpreterOption.fromInterpreterOption(o.getOption());
|
||||
|
||||
InterpreterSetting setting = new InterpreterSetting(o.getName(), o.getName(),
|
||||
o.getInterpreterInfos(), props, deps, o.getOption(), o.getPath());
|
||||
infos, props, deps, option, o.getPath());
|
||||
setting.setInterpreterGroupFactory(this);
|
||||
return setting;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue